﻿<!-- #Include File="../Include/Admin_Onlogin.asp" -->
<!-- #Include File="../../Include/Pinyin.asp" -->
<%
Data_Name = "{prefix}Class"
strFileName = "Admin_Class.asp"
Dim sqlAuth, rsAuth, PurviewID
sqlAuth = "Select AuthID From Admin_Auth Where href='Admin/" & strFileName & "?ChannelID="&ChannelID&"' Order By sort Asc,AuthID Asc"
Call Exec(rsAuth,sqlAuth,2)
If rsAuth.BOF And rsAuth.EOF Then
	PurviewID = 0
Else
	PurviewID = rsAuth(0)
	CheckPurview PurviewID,0
End If
rsAuth.Close
Set rsAuth = Nothing
Select Case Action
Case "Add"
	sqlAuth = "Select AuthID From Admin_Auth Where pid="&PurviewID&" And href='Class/Add' Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		CheckPurview 0,0
	Else
		CheckPurview rsAuth(0),0
	End If
	rsAuth.Close
	Set rsAuth = Nothing
	Class_Add()
Case "AddMore"
	sqlAuth = "Select AuthID From Admin_Auth Where pid="&PurviewID&" And href='Class/Add' Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		CheckPurview 0,0
	Else
		CheckPurview rsAuth(0),0
	End If
	rsAuth.Close
	Set rsAuth = Nothing
	Class_AddMore()
Case "SaveAdd"
	sqlAuth = "Select AuthID From Admin_Auth Where pid="&PurviewID&" And href='Class/Insert' Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		CheckPurview 0,1
	Else
		CheckPurview rsAuth(0),1
	End If
	rsAuth.Close
	Set rsAuth = Nothing
	SaveAdd()
Case "SaveAddMore"
	sqlAuth = "Select AuthID From Admin_Auth Where pid="&PurviewID&" And href='Class/Insert' Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		CheckPurview 0,1
	Else
		CheckPurview rsAuth(0),1
	End If
	rsAuth.Close
	Set rsAuth = Nothing
	SaveAddMore()
Case "Edit"
	sqlAuth = "Select AuthID From Admin_Auth Where pid="&PurviewID&" And href='Class/Edit' Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		CheckPurview 0,0
	Else
		CheckPurview rsAuth(0),0
	End If
	rsAuth.Close
	Set rsAuth = Nothing
	Class_Edit()
Case "SaveModify"
	sqlAuth = "Select AuthID From Admin_Auth Where pid="&PurviewID&" And href='Class/Update' Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		CheckPurview 0,1
	Else
		CheckPurview rsAuth(0),1
	End If
	rsAuth.Close
	Set rsAuth = Nothing
	SaveModify()
Case "Del"
	sqlAuth = "Select AuthID From Admin_Auth Where pid="&PurviewID&" And href='Class/Del' Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		CheckPurview 0,1
	Else
		CheckPurview rsAuth(0),1
	End If
	rsAuth.Close
	Set rsAuth = Nothing
	Class_Del()
Case "DelHtml"
	sqlAuth = "Select AuthID From Admin_Auth Where pid="&PurviewID&" And href='Class/Del' Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		CheckPurview 0,1
	Else
		CheckPurview rsAuth(0),1
	End If
	rsAuth.Close
	Set rsAuth = Nothing
	Class_DelHtml()
Case "Mod"
	sqlAuth = "Select AuthID From Admin_Auth Where pid="&PurviewID&" And href='Class/Mod' Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		CheckPurview 0,0
	Else
		CheckPurview rsAuth(0),0
	End If
	rsAuth.Close
	Set rsAuth = Nothing
	Class_Mod()
Case "SaveMod"
	sqlAuth = "Select AuthID From Admin_Auth Where pid="&PurviewID&" And href='Class/Mod' Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		CheckPurview 0,1
	Else
		CheckPurview rsAuth(0),1
	End If
	rsAuth.Close
	Set rsAuth = Nothing
	Class_SaveMod()
Case "ListOrder"
	sqlAuth = "Select AuthID From Admin_Auth Where pid="&PurviewID&" And href='Class/Order' Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		CheckPurview 0,1
	Else
		CheckPurview rsAuth(0),1
	End If
	rsAuth.Close
	Set rsAuth = Nothing
	ListOrder()
Case "Order"
	sqlAuth = "Select AuthID From Admin_Auth Where pid="&PurviewID&" And href='Class/Order' Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		CheckPurview 0,0
	Else
		CheckPurview rsAuth(0),0
	End If
	rsAuth.Close
	Set rsAuth = Nothing
	Class_Order()
Case "SaveOrder"
	sqlAuth = "Select AuthID From Admin_Auth Where pid="&PurviewID&" And href='Class/Order' Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		CheckPurview 0,1
	Else
		CheckPurview rsAuth(0),1
	End If
	rsAuth.Close
	Set rsAuth = Nothing
	Class_SaveOrder()
Case "Directory"
	sqlAuth = "Select AuthID From Admin_Auth Where pid="&PurviewID&" And href='Class/Directory' Order By sort Asc,AuthID Asc"
	Call Exec(rsAuth,sqlAuth,2)
	If rsAuth.BOF And rsAuth.EOF Then
		CheckPurview 0,0
	Else
		CheckPurview rsAuth(0),0
	End If
	rsAuth.Close
	Set rsAuth = Nothing
	Class_Directory()
Case "ToPinyin"
	ToPinyin()
Case Else
	Class_Main()
End Select
If FoundErr=True Then
	Call WriteErrMsg(ErrMsg, ComeUrl)
End If
Call CloseConn()

Sub Class_Main()
	If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
		ChannelID = Code_CLng(Trim(Code_Form("ChannelID")))
		Sql = "Select * From ["&Data_Name&"]"
		If ChannelID<>0 Then
			Sql = Sql & " Where ChannelID=" & ChannelID & ""
		End If
		Sql = Sql & " Order By ClassOrder Asc,ClassID Asc"
		Call Exe_Conn(RsClass,Sql,1)
		i = 0
		If RsClass.BOF And RsClass.EOF Then
			data = ""
		Else
			totalPut = RsClass.RecordCount
			Do While Not RsClass.Eof
				If RsClass("ChannelID") > 0 Then
					sqlChannel = "select * from Channel where ChannelID=" & Code_CLng(RsClass("ChannelID"))
					Call Exec(rsChannel,sqlChannel,2)
					If rsChannel.BOF And rsChannel.EOF Then
						ChannelTit = ""
						rsChannel.Close
						Set rsChannel = Nothing
					Else
						ChannelTit = ToUnicode(Code_Html(rsChannel("ChannelTit"),1,0))
						rsChannel.Close
						Set rsChannel = Nothing
					End If
				End If
				If ChannelIsCreateHtml = True Then
					ClassUrl = InstallDir & ChannelDir & "/" & RsClass("HtmlFileDir") & "Index" & ChannelHtmlExtName
				Else
					ClassUrl = InstallDir & ChannelDir & "/List.asp?ClassID=" & RsClass("ClassID")
				End If
				ClassUrl = Replace(ClassUrl,"/","\/")
				fos=""
				foo=""
				If RsClass("ClassDepth")=0 Then
					oFolder="<img border='0' src='../images/tree_folder1.png' align='absmiddle'>"
				Else
					If RsClass("ClassChild")=0 Then
						foo=foo&"<img border='0' src='../images/tree_minus.gif' align='absmiddle'>"
					Else
						foo=foo&"<img border='0' src='../images/tree_plus.gif' align='absmiddle'>"
					End If
					For fi=2 To RsClass("ClassDepth")
						fos=fos&"<img border='0' src='../images/tree_empty.gif' align='absmiddle'>"
					Next
					oFolder="<img border='0' src='../images/tree_folder2.png' align='absmiddle'>"
				End If
				foo=fos&foo&oFolder
				If i=0 Then
					data = data & "{""id"":"&RsClass("ClassID")&",""ChannelID"":"&RsClass("ChannelID")&",""ClassName"":"""&ToUnicode(RsClass("ClassName"))&""",""ClassDir"":"""&RsClass("ClassDir")&""",""ClassUrl"":"""&ClassUrl&""",""ChannelName"":"""&ChannelTit&""",""ClassParent"":"&RsClass("ClassParent")&",""sort"":"&RsClass("ClassOrder")&"}"
				Else
					data = data & ",{""id"":"&RsClass("ClassID")&",""ChannelID"":"&RsClass("ChannelID")&",""ClassName"":"""&ToUnicode(RsClass("ClassName"))&""",""ClassDir"":"""&RsClass("ClassDir")&""",""ClassUrl"":"""&ClassUrl&""",""ChannelName"":"""&ChannelTit&""",""ClassParent"":"&RsClass("ClassParent")&",""sort"":"&RsClass("ClassOrder")&"}"
				End If
				RsClass.MoveNext
				i=i+1
			Loop
			RsClass.Close
		End If
		If totalPut = 0 Then
			Response.Write "{""code"":201,""msg"":""\u65e0\u6570\u636e""}" & vbCrLf
		Else
			Response.Write "{""code"":0,""msg"":""\u83b7\u53d6\u6210\u529f\uff01"",""count"":"&totalPut&",""data"":["&data&"],""rel"":1}" & vbCrLf
		End If
		Response.End()
	Else
		Response.Write "<!DOCTYPE html>" & vbCrLf
		Response.Write "<head>" & vbCrLf
		Response.Write "<title>栏目列表</title>" & vbCrlf
		Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" & vbCrLf
		Response.Write "<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'>" & vbCrLf
		Response.Write "<meta name='apple-mobile-web-app-status-bar-style' content='black'>" & vbCrLf
		Response.Write "<meta name='apple-mobile-web-app-capable' content='yes'>" & vbCrLf
		Response.Write "<meta name='format-detection' content='telephone=no'>" & vbCrLf
		Response.Write "<link rel=""stylesheet"" type=""text/css"" href=""../fonts/font-awesome/css/font-awesome.min.css"" />" & vbCrLf
		Response.Write "<link href='../Plugins/layui/css/layui.css' rel='stylesheet' type='text/css' />" & vbCrLf
		Response.Write "<link href='../Style/global.css' rel='stylesheet' type='text/css' />" & vbCrLf
		Response.Write "<link href='../Style/font.css' rel='stylesheet' type='text/css' />" & vbCrLf
		Response.Write "<script type='text/javascript'>" & vbCrLf
		Response.Write "var pc_file = '" & InstallDir & "';" & vbCrLf
		Response.Write "var admin_file = '" & AdminFolder & "/';" & vbCrLf
		Response.Write "</script>" & vbCrLf
		Response.Write "<script type='text/javascript' src='../Js/Admin.js'></script>" & vbCrLf
		Response.Write "<script type='text/javascript' src='../../Dialog/main.js'></script>" & vbCrLf
		Response.Write "<script type='text/javascript' src='../../Dialog/lhgcore.min.js'></script>" & vbCrLf
		Response.Write "<script type='text/javascript' src='../../Dialog/lhgcalendar.min.js'></script>" & vbCrLf
		Response.Write "<script type=""text/javascript"" src=""../Plugins/layui/layui.js""></script>" & vbCrLf
		Response.Write "</head>" & vbCrlf
		Response.Write "<body>" & vbCrlf
		Response.Write "<div class=""admin-main layui-anim layui-anim-upbit"">" & vbCrlf
		Response.Write "    <fieldset class=""layui-elem-field layui-field-title"">" & vbCrlf
		Response.Write "        <legend>" & ChannelTit & "栏目列表</legend>" & vbCrlf
		Response.Write "    </fieldset>" & vbCrlf
		Response.Write "    <blockquote class=""layui-elem-quote"">" & vbCrlf
		Response.Write "        <a href=""?ChannelID=" & ChannelID & "&Action=Add"" class=""layui-btn layui-btn-sm"">" & vbCrlf
		Response.Write "            <i class=""fa fa-plus""></i> 添加栏目" & vbCrlf
		Response.Write "        </a>" & vbCrlf
		Response.Write "        <a href=""?ChannelID=" & ChannelID & "&Action=AddMore"" class=""layui-btn layui-btn-sm"">" & vbCrlf
		Response.Write "            <i class=""fa fa-plus-square""></i> 批量添加栏目" & vbCrlf
		Response.Write "        </a>" & vbCrlf
		Response.Write "        <a href=""?ChannelID=" & ChannelID & "&Action=Mod"" class=""layui-btn layui-btn-sm"">" & vbCrlf
		Response.Write "            <i class=""fa fa-history  ""></i> 合并栏目" & vbCrlf
		Response.Write "        </a>" & vbCrlf
		Response.Write "        <a href=""?ChannelID=" & ChannelID & "&Action=Order"" class=""layui-btn layui-btn-sm"">" & vbCrlf
		Response.Write "            <i class=""fa fa-sort-amount-asc""></i> 重新排序" & vbCrlf
		Response.Write "        </a>" & vbCrlf
		Response.Write "        <a href=""?ChannelID=" & ChannelID & "&Action=Directory"" class=""layui-btn layui-btn-sm"">" & vbCrlf
		Response.Write "            <i class=""fa fa-refresh""></i> 重新整理目录" & vbCrlf
		Response.Write "        </a>" & vbCrlf
		Response.Write "        <a class=""layui-btn layui-btn-normal layui-btn-sm""  onclick=""openAll();"">" & vbCrlf
		Response.Write "            <i class=""fa fa-folder-open-o""></i> 展开或折叠全部" & vbCrlf
		Response.Write "        </a>" & vbCrlf
		Response.Write "    </blockquote>" & vbCrlf
		Response.Write "    <table class=""layui-table"" id=""treeTable"" lay-filter=""treeTable""></table>" & vbCrlf
		Response.Write "</div>" & vbCrlf
		Response.Write "<script type=""text/html"" id=""action"">" & vbCrLf
		Response.Write "    <a href=""{{d.ClassUrl}}"" target=""_blank"" class=""layui-btn layui-btn-xs layui-btn-normal""><i class=""fa fa-chrome""></i> 访问</a>" & vbCrlf
		Response.Write "    <a href=""?Action=Add&ChannelID=" & ChannelID & "&Pid={{d.id}}"" class=""layui-btn layui-btn-xs""><i class=""fa fa-plus""></i> 添加子栏目</a>" & vbCrlf
		Response.Write "    <a href=""?Action=Edit&ChannelID=" & ChannelID & "&ClassID={{d.id}}"" class=""layui-btn layui-btn-xs""><i class=""fa fa-edit""></i> 编辑</a>" & vbCrLf
		Response.Write "    <a class=""layui-btn layui-btn-xs layui-btn-danger"" lay-event=""del""><i class=""fa fa-trash-o""></i> 删除</a>" & vbCrLf
		If ChannelIsCreateHtml = True Then Response.Write "    <a class=""layui-btn layui-btn-xs layui-btn-danger"" lay-event=""delhtml""><i class=""fa fa-trash-o""></i> 删除Html</a>" & vbCrLf
		Response.Write "</script>" & vbCrLf
		Response.Write "<script type=""text/html"" id=""order"">" & vbCrLf
		Response.Write "    <input name=""{{d.id}}"" data-id=""{{d.id}}"" class=""list_order layui-input"" value=""{{d.sort}}"" size=""10""/>" & vbCrLf
		Response.Write "</script>" & vbCrLf
		Response.Write "<script>" & vbCrlf
		Response.Write "    var editObj=null,ptable=null,treeGrid=null,tableId='treeTable',layer=null;" & vbCrlf
		Response.Write "    layui.config({" & vbCrlf
		Response.Write "        base: pc_file + admin_file + '/Plugins/layui/extend/'" & vbCrlf
		Response.Write "    }).extend({" & vbCrlf
		Response.Write "        treeGrid:'treeGrid'" & vbCrlf
		Response.Write "    }).use(['jquery','treeGrid','layer','form'], function(){" & vbCrlf
		Response.Write "        var $=layui.jquery;" & vbCrlf
		Response.Write "        treeGrid = layui.treeGrid;" & vbCrlf
		Response.Write "        layer=layui.layer;" & vbCrlf
		Response.Write "		form = layui.form;" & vbCrlf
		Response.Write "        ptable=treeGrid.render({" & vbCrlf
		Response.Write "            id:tableId" & vbCrlf
		Response.Write "            ,elem: '#'+tableId" & vbCrlf
		Response.Write "            ,idField:'id'" & vbCrlf
		Response.Write "            ,url:'?Action=Main'" & vbCrlf
		Response.Write "            ,method: 'post'" & vbCrLf
		Response.Write "            ,where: {//设定异步数据接口的参数" & vbCrLf
		Response.Write "                ChannelID: '"&ChannelID&"'" & vbCrLf
		Response.Write "            }" & vbCrLf
		Response.Write "            ,cellMinWidth: 100" & vbCrlf
		Response.Write "            ,treeId:'id'//树形id字段名称" & vbCrlf
		Response.Write "            ,treeUpId:'ClassParent'//树形父id字段名称" & vbCrlf
		Response.Write "            ,treeShowName:'ClassName'//以树形式显示的字段" & vbCrlf
		Response.Write "            ,height:'full-140'" & vbCrlf
		Response.Write "            ,isFilter:false" & vbCrlf
		Response.Write "            ,iconOpen:true//是否显示图标【默认显示】" & vbCrlf
		Response.Write "            ,isOpenDefault:true//节点默认是展开还是折叠【默认展开】" & vbCrlf
		Response.Write "            ,cols: [[" & vbCrlf
		Response.Write "                {field: 'id', title: '编号', width: 80, fixed: true}," & vbCrlf
		Response.Write "                {field: 'ClassName', title: '栏目名称', width: 350}," & vbCrlf
		Response.Write "                {field: 'ClassDir', title: '栏目地址/目录', width: 300}," & vbCrlf
		Response.Write "                {field: 'ChannelName', title: '所属模型', width: 120}," & vbCrlf
		Response.Write "                {field: 'sort', title: '排序', width: 100, templet: '#order'}," & vbCrLf
		Response.Write "                {title: '操作',width: 420,align: 'center', toolbar: '#action'}" & vbCrlf
		Response.Write "            ]]" & vbCrlf
		Response.Write "            ,page:false" & vbCrlf
		Response.Write "        });" & vbCrlf
		Response.Write "        treeGrid.on('tool('+tableId+')',function (obj) {" & vbCrlf
		Response.Write "			var data = obj.data;" & vbCrlf
		Response.Write "            if(obj.event === 'del'){" & vbCrlf
		Response.Write "                layer.confirm('你确定要删除该栏目及其子栏目吗？', function(index){" & vbCrlf
		Response.Write "                    $.ajax({" & vbCrLf
		Response.Write "                        type: 'post'," & vbCrLf
		Response.Write "                        url: '?Action=Del'," & vbCrLf
		Response.Write "                        data: {ClassID:data.id,ChannelID:"&ChannelID&"}," & vbCrLf
		Response.Write "                        dataType: 'json'," & vbCrLf
		Response.Write "                        success: function(res) {" & vbCrLf
		Response.Write "                            if (res.code == 1) {" & vbCrLf
		Response.Write "                                layer.msg(res.msg,{time:1000,icon:1});" & vbCrLf
		Response.Write "                                obj.del();" & vbCrLf
		Response.Write "                            }else{" & vbCrLf
		Response.Write "                                layer.msg(res.msg,{time:1000,icon:2});" & vbCrLf
		Response.Write "                            }" & vbCrLf
		Response.Write "                        }" & vbCrLf
		Response.Write "                    });" & vbCrLf
		Response.Write "                    layer.close(index);" & vbCrlf
		Response.Write "                });" & vbCrlf
		Response.Write "            }" & vbCrlf
		Response.Write "            if(obj.event === 'delhtml'){" & vbCrlf
		Response.Write "                layer.confirm('删除栏目首页Html文件？', function(index){" & vbCrlf
		Response.Write "                    $.ajax({" & vbCrLf
		Response.Write "                        type: 'post'," & vbCrLf
		Response.Write "                        url: '?Action=DelHtml'," & vbCrLf
		Response.Write "                        data: {ClassID:data.id,ChannelID:"&ChannelID&"}," & vbCrLf
		Response.Write "                        dataType: 'json'," & vbCrLf
		Response.Write "                        success: function(res) {" & vbCrLf
		Response.Write "                            if (res.code == 1) {" & vbCrlf
		Response.Write "                                layer.alert(res.msg, {icon: 1}, function(index){" & vbCrlf
		Response.Write "                                    location.href=res.url;" & vbCrlf
		Response.Write "                                });" & vbCrlf
		Response.Write "                            }else{" & vbCrlf
		Response.Write "                                layer.msg(res.msg,{time:1000,icon:2});" & vbCrLf
		Response.Write "                            }" & vbCrlf
		Response.Write "                        }" & vbCrLf
		Response.Write "                    });" & vbCrLf
		Response.Write "                    layer.close(index);" & vbCrlf
		Response.Write "                });" & vbCrlf
		Response.Write "            }" & vbCrlf
		Response.Write "        });" & vbCrlf
		Response.Write "        $('body').on('blur','.list_order',function() {" & vbCrlf
		Response.Write "            var id = $(this).attr('data-id');" & vbCrlf
		Response.Write "            var sort = $(this).val();" & vbCrlf
		Response.Write "            var loading = layer.load(1, {shade: [0.1, '#fff']});" & vbCrlf
		Response.Write "            $.ajax({" & vbCrLf
		Response.Write "                type: 'post'," & vbCrLf
		Response.Write "                url: '?Action=ListOrder'," & vbCrLf
		Response.Write "                data: {ClassID:id,ClassOrder:sort,ChannelID:"&ChannelID&"}," & vbCrLf
		Response.Write "                dataType: 'json'," & vbCrLf
		Response.Write "                success: function(res) {" & vbCrLf
		Response.Write "                    layer.close(loading);" & vbCrlf
		Response.Write "                    if(res.code == 1){" & vbCrlf
		Response.Write "                        layer.msg(res.msg, {time: 1000, icon: 1}, function () {" & vbCrlf
		Response.Write "                            location.href = res.url;" & vbCrlf
		Response.Write "                        });" & vbCrlf
		Response.Write "                    }else{" & vbCrlf
		Response.Write "                        layer.msg(res.msg,{time:1000,icon:2});" & vbCrlf
		Response.Write "                        treeGrid.render;" & vbCrlf
		Response.Write "                    }" & vbCrlf
		Response.Write "                }" & vbCrLf
		Response.Write "            });" & vbCrLf
		Response.Write "        });" & vbCrlf
		Response.Write "    });" & vbCrlf
		Response.Write "    function openAll() {" & vbCrlf
		Response.Write "        var treedata=treeGrid.getDataTreeList(tableId);" & vbCrlf
		Response.Write "        treeGrid.treeOpenAll(tableId,!treedata[0][treeGrid.config.cols.isOpen]);" & vbCrlf
		Response.Write "    }" & vbCrlf
		Response.Write "</script>" & vbCrlf
		Response.Write "</body>" & vbCrLf & "</html>"
	End If
End Sub

Sub Class_Add()
	Response.Write "<!DOCTYPE html>" & vbCrLf
	Response.Write "<head>" & vbCrLf
	Response.Write "<title>栏目列表</title>" & vbCrlf
	Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" & vbCrLf
	Response.Write "<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-status-bar-style' content='black'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-capable' content='yes'>" & vbCrLf
	Response.Write "<meta name='format-detection' content='telephone=no'>" & vbCrLf
	Response.Write "<link rel=""stylesheet"" type=""text/css"" href=""../fonts/font-awesome/css/font-awesome.min.css"" />" & vbCrLf
	Response.Write "<link href='../Plugins/layui/css/layui.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link href='../Style/global.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link href='../Style/font.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<script type='text/javascript'>" & vbCrLf
	Response.Write "var pc_file = '" & InstallDir & "';" & vbCrLf
	Response.Write "var admin_file = '" & AdminFolder & "/';" & vbCrLf
	Response.Write "</script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../Js/Admin.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/main.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcore.min.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcalendar.min.js'></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/layui/layui.js""></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/xm-select/xm-select.js""></script>" & vbCrLf
	Response.Write "</head>" & vbCrlf
	Response.Write "<body>" & vbCrlf
	Dim Pid
	Pid=Code_ID("Pid")
	Response.Write "<form class='layui-form layui-form-pane' id=""myform"" name=""myform"" action='?Action=SaveAdd&ChannelID=" & ChannelID & "&ClassID=" & ClassID & "&Pid=" & Pid & "' method=post>" & vbCrlf
	Response.Write "<div class=""admin-main fadeInUp animated"">" & vbCrlf
	Response.Write "    <fieldset class=""layui-elem-field layui-field-title"">" & vbCrlf
	Response.Write "        <legend>添加栏目</legend>" & vbCrlf
	Response.Write "    </fieldset>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">栏目名称：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	Response.Write "            <input type='text' id='ClassName' name='ClassName' value='' size='30' maxlength='20' lay-verify=""ClassName"" class=""layui-input"" onblur=""to_pinyin('ClassDir','ClassName','" & strFileName & "');"">" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">栏目目录：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	Response.Write "            <input id='ClassDir' name='ClassDir' type='text' value='' size='30' maxlength='255' class=""layui-input"">" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">上级栏目：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	Response.Write "            <div id=""ClassID"" class=""xm-select-demo""></div>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">栏目图片：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-2"">" & vbCrlf
	Response.Write "            <input id='ClassPic' name='ClassPic' type='text' value='' size='30' maxlength='255' class=""layui-input"">" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "        <div class=""layui-input-2"">" & vbCrlf
	Response.Write "            <button type=""button"" class=""layui-btn"" hidefocus=""true"" onclick=""UploadFile('"&ChannelID&"','"&ChannelModuleType&"','1','0','"&ClassID&"','1','0','0','ClassPic','','','','','" & InstallDir & UploadSetting(1) & "','" & UploadSetting(1) & "','" & InstallDir & "','" & InstallDir & UploadSetting(1) & "/" & ChannelDir & "','/" & ChannelDir & "');"">上传</button>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item layui-form-text"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">栏目META关键词：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-block"">" & vbCrlf
	Response.Write "            <textarea name='MetaKeyWord' id='MetaKeyWord' cols='60' rows='5' class=""layui-textarea""></textarea>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item layui-form-text"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">栏目META网页描述：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-block"">" & vbCrlf
	Response.Write "            <textarea name='MetaDescript' id='MetaDescript' cols='60' rows='5' class=""layui-textarea""></textarea>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <div class=""layui-inline"">" & vbCrlf
	Response.Write "            <label class=""layui-form-label"">截断字数：</label>" & vbCrlf
	Response.Write "            <div class=""layui-input-inline"">" & vbCrlf
	Response.Write "                <input type='number' min=""0"" id='CuteNums' name='CuteNums' value='' size='5' maxlength='20' class=""layui-input"">" & vbCrlf
	Response.Write "            </div>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <div class=""layui-inline"">" & vbCrlf
	Response.Write "            <label class=""layui-form-label"">每行几个：</label>" & vbCrlf
	Response.Write "            <div class=""layui-input-inline"">" & vbCrlf
	Response.Write "                <input type='number' min=""1"" id='Columns' name='Columns' value='' size='5' maxlength='20' class=""layui-input"">" & vbCrlf
	Response.Write "            </div>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <div class=""layui-inline"">" & vbCrlf
	Response.Write "            <label class=""layui-form-label"">分页：</label>" & vbCrlf
	Response.Write "            <div class=""layui-input-inline"">" & vbCrlf
	Response.Write "                <input type='number' min=""0"" id='PageNum' name='PageNum' value='20' size='5' maxlength='20' class=""layui-input"">" & vbCrlf
	Response.Write "            </div>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "<fieldset class=""layui-elem-field"">" & vbCrlf
	Response.Write "<legend>图片属性：</legend>" & vbCrlf
	Response.Write "<div class=""layui-field-box"">" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <div class=""layui-inline"">" & vbCrlf
	Response.Write "            <label class=""layui-form-label"">图片宽度：</label>" & vbCrlf
	Response.Write "            <div class=""layui-input-inline"">" & vbCrlf
	Response.Write "                <input type='number' min=""0"" id='ImageWidth' name='ImageWidth' value='' size='5' maxlength='20' class=""layui-input"">" & vbCrlf
	Response.Write "            </div>" & vbCrlf
	Response.Write "            <div class=""layui-form-mid layui-word-aux"">px</div>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "        <div class=""layui-inline"">" & vbCrlf
	Response.Write "            <label class=""layui-form-label"">图片高度：</label>" & vbCrlf
	Response.Write "            <div class=""layui-input-inline"">" & vbCrlf
	Response.Write "                <input type='number' min=""0"" id='ImageHeight' name='ImageHeight' value='' size='5' maxlength='20' class=""layui-input"">" & vbCrlf
	Response.Write "            </div>" & vbCrlf
	Response.Write "            <div class=""layui-form-mid layui-word-aux"">px</div>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "</div>" & vbCrlf
	Response.Write "</fieldset>" & vbCrlf
	'Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	'Response.Write "        <label class=""layui-form-label"">栏目模板：</label>" & vbCrlf
	'Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	'Response.Write "            " & Admin_ShowMoban_Option("","Moban","list",ChannelID) & "" & vbCrlf
	'Response.Write "        </div>" & vbCrlf
	'Response.Write "    </div>" & vbCrlf
	'Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	'Response.Write "        <label class=""layui-form-label"">栏目风格：</label>" & vbCrlf
	'Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	'Response.Write "            " & Admin_ShowSkin_Option("","SkinID",6) & "" & vbCrlf
	'Response.Write "        </div>" & vbCrlf
	'Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">栏目模板：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-inline"">" & vbCrlf
	Response.Write "            <input type='text' id='Moban' name='Moban' value='' size='40' maxlength='255' class='layui-input' readonly=""readonly"">" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "        <div class=""layui-input-block"">" & vbCrlf
	Response.Write "            <button type=""button"" class=""layui-btn"" hidefocus=""true"" onclick=""SelectMoban('" & ChannelID & "','Moban');"">选择模板</button><button type=""button"" class=""layui-btn layui-btn-danger"" hidefocus=""true"" onclick=""ClearColor('Moban');"">清空</button>&nbsp;&nbsp;可以为空" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">栏目风格：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-inline"">" & vbCrlf
	Response.Write "            <input type='text' id='SkinID' name='SkinID' value='' size='40' maxlength='255' class='layui-input' readonly=""readonly"">" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "        <div class=""layui-input-block"">" & vbCrlf
	Response.Write "            <button type=""button"" class=""layui-btn"" hidefocus=""true"" onclick=""SelectCss('SkinID');"">选择风格</button><button type=""button"" class=""layui-btn layui-btn-danger"" hidefocus=""true"" onclick=""ClearColor('SkinID');"">清空</button>&nbsp;&nbsp;可以为空" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	'Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	'Response.Write "        <label class=""layui-form-label"">页面框架：</label>" & vbCrlf
	'Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	'Response.Write "            " & Admin_ShowTemplate_Option(0,"TemplateID",2,ChannelID) & "" & vbCrlf
	'Response.Write "        </div>" & vbCrlf
	'Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label""><font color='#FF0000'>内容模板：</font></label>" & vbCrlf
	Response.Write "        <div class=""layui-input-inline"">" & vbCrlf
	Response.Write "            <input type='text' id='ContentMoban' name='ContentMoban' value='' size='40' maxlength='255' class='layui-input' readonly=""readonly"">" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "        <div class=""layui-input-block"">" & vbCrlf
	Response.Write "            <button type=""button"" class=""layui-btn"" hidefocus=""true"" onclick=""SelectMoban('" & ChannelID & "','ContentMoban');"">选择模板</button><button type=""button"" class=""layui-btn layui-btn-danger"" hidefocus=""true"" onclick=""ClearColor('ContentMoban');"">清空</button>&nbsp;&nbsp;可以为空" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label""><font color='#FF0000'>内容风格：</font></label>" & vbCrlf
	Response.Write "        <div class=""layui-input-inline"">" & vbCrlf
	Response.Write "            <input type='text' id='ContentSkinID' name='ContentSkinID' value='' size='40' maxlength='255' class='layui-input' readonly=""readonly"">" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "        <div class=""layui-input-block"">" & vbCrlf
	Response.Write "            <button type=""button"" class=""layui-btn"" hidefocus=""true"" onclick=""SelectCss('ContentSkinID');"">选择风格</button><button type=""button"" class=""layui-btn layui-btn-danger"" hidefocus=""true"" onclick=""ClearColor('ContentSkinID');"">清空</button>&nbsp;&nbsp;可以为空" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	'Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	'Response.Write "        <label class=""layui-form-label""><font color='#FF0000'>内容框架：</font></label>" & vbCrlf
	'Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	'Response.Write "            " & Admin_ShowTemplate_Option(0,"ContentTemplateID",3,ChannelID) & "" & vbCrlf
	'Response.Write "        </div>" & vbCrlf
	'Response.Write "    </div>" & vbCrlf
	Response.Write "</div>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<input name=""ChannelID"" type=""hidden"" id=""ChannelID"" value=""" & ChannelID & """>" & Submit_Layui("提交添加","重新填写","确认要清空对话框内容？","javascript:history.back();","返回上一页","") & vbCrlf
	Response.Write "</form>" & vbCrlf
	Response.Write "<script>" & vbCrlf
	Response.Write "layui.use(['form'], function () {" & vbCrlf
	Response.Write "    var form = layui.form;" & vbCrlf
	Response.Write "    //自定义表单验证" & vbCrlf
	Response.Write "    form.verify({" & vbCrlf
	Response.Write "        ClassName: function (value, item) {" & vbCrlf
	Response.Write "            if (!value){" & vbCrlf
	Response.Write "                item.focus();" & vbCrlf
	Response.Write "                return ""栏目名称不能为空！"";" & vbCrlf
	Response.Write "            }" & vbCrlf
	Response.Write "        }," & vbCrlf
	Response.Write "        ClassID: function (value, item) {" & vbCrlf
	Response.Write "            if (!value){" & vbCrlf
	Response.Write "                item.focus();" & vbCrlf
	Response.Write "                return ""请选择" & ChannelTit & "栏目！"";" & vbCrlf
	Response.Write "            }" & vbCrlf
	Response.Write "        }," & vbCrlf
	Response.Write "    })" & vbCrLf
	Response.Write "    var ClassID = xmSelect.render({" & vbCrLf
	Response.Write "        el: '#ClassID'," & vbCrLf
	Response.Write "        name: 'ClassID'," & vbCrLf
	Response.Write "        layVerify: 'ClassID'," & vbCrLf
	Response.Write "        radio: true," & vbCrLf
	Response.Write "        clickClose: true," & vbCrLf
	'Response.Write "        tips: '指定栏目的" & ChannelTit & "?'," & vbCrLf
	'Response.Write "        empty: '呀, 没有数据呢'," & vbCrLf
	Response.Write "        autoRow: true," & vbCrLf
	Response.Write "        filterable: true," & vbCrLf
	Response.Write "        height: '300px'," & vbCrLf
	Response.Write "        direction: 'down'," & vbCrLf
	Response.Write "        tree: {" & vbCrLf
	Response.Write "            show: true,//是否显示树状结构" & vbCrLf
	Response.Write "            showFolderIcon: true,//是否展示三角图标" & vbCrLf
	Response.Write "            showLine: true,//是否显示虚线" & vbCrLf
	Response.Write "            indent: 20,//间距" & vbCrLf
	Response.Write "            expandedKeys: true,//默认展开节点的数组, 为 true 时, 展开所有节点" & vbCrLf
	Response.Write "            strict: false,//是否严格遵守父子模式" & vbCrLf
	Response.Write "        }," & vbCrLf
	Response.Write "        toolbar: {" & vbCrLf
	Response.Write "            show: false," & vbCrLf
	Response.Write "            list: ['ALL', 'REVERSE', 'CLEAR']" & vbCrLf
	Response.Write "        }," & vbCrLf
	Response.Write "        data: [" & vbCrLf
	Response.Write "            {name: '作为一级栏目', value: 0"
	If Int(Pid)=Int(0) Then Response.Write ", selected: true"
	Response.Write "}," & vbCrLf
	Response.Write GetClass_Option(ChannelID, 0, Pid)
	Response.Write "        ]" & vbCrLf
	Response.Write "    })" & vbCrLf
	Response.Write "    //提交监听" & vbCrlf
	Response.Write "    form.on('submit(submit)', function (data) {" & vbCrlf
	Response.Write "        loading = layer.load(1, {shade: [0.1,'#fff']});" & vbCrlf
	Response.Write "        $.ajax({" & vbCrLf
	Response.Write "            type: 'post'," & vbCrLf
	Response.Write "            url: '?Action=SaveAdd'," & vbCrLf
	Response.Write "            data: data.field," & vbCrLf
	Response.Write "            dataType: 'json'," & vbCrLf
	Response.Write "            success: function(res) {" & vbCrLf
	Response.Write "                layer.close(loading);" & vbCrlf
	Response.Write "                if(res.code > 0){" & vbCrlf
	If ChannelIsCreateHtml = True Then
		Response.Write "                    var diag = new Dialog({" & vbCrlf
		Response.Write "                        id:'CreateClass'," & vbCrlf
		Response.Write "                        title:'正在生成相关数据'," & vbCrlf
		Response.Write "                        url:'" & InstallDir & AdminFolder & "/" & ChannelDir & "/Admin_Create" & ChannelDir & ".asp?Action=ListCont&ClassList=1&ChannelID='+res.ChannelID+'&Csid='+res.ClassID+''," & vbCrlf
		Response.Write "                        width:450," & vbCrlf
		Response.Write "                        height:200," & vbCrlf
		Response.Write "                        modal:true" & vbCrlf
		Response.Write "                    });" & vbCrlf
		Response.Write "                    diag.autoClose=1;" & vbCrlf
		Response.Write "                    diag.show();" & vbCrlf
		Response.Write "                    setTimeout(function(){" & vbCrlf
		Response.Write "                        layer.msg(res.msg,{icon: 1, time: 1000},function(){" & vbCrlf
		Response.Write "                            location.href = res.url;" & vbCrlf
		Response.Write "                        });" & vbCrlf
		Response.Write "                    },1500);" & vbCrlf
	Else
		Response.Write "                    layer.msg(res.msg,{icon: 1, time: 1000},function(){" & vbCrlf
		Response.Write "                        location.href = res.url;" & vbCrlf
		Response.Write "                    });" & vbCrlf
	End If
	Response.Write "                }else{" & vbCrlf
	Response.Write "                    layer.msg(res.msg,{icon: 2, time: 1000});" & vbCrlf
	Response.Write "                }" & vbCrlf
	Response.Write "            }" & vbCrLf
	Response.Write "        });" & vbCrLf
	Response.Write "    });" & vbCrlf
	Response.Write "});" & vbCrlf
	Response.Write "</script>" & vbCrlf
	Response.Write "</body>" & vbCrLf & "</html>"
End Sub

Sub SaveAdd()
	If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
		Dim ImageWidth,ImageHeight,CuteNums,Columns,PageNum
		Dim ClassName,ClassDir,ClassPic,cFir,ClassDepth,ClassParentStr,ClassOrder,fo_id,firid,HtmlFileDir,CHtmlFileDir,MetaKeyWord,MetaDescript,Moban,SkinID,TemplateID,ContentMoban,ContentSkinID,ContentTemplateID
		AClassID=1
		ChannelID=Trim(Request.Form("ChannelID"))
		Sql="Select Top 1 AClassID From "&Data_Name&" Where ChannelID="&ChannelID&" Order By AClassID"
		Call Exec(Rs,Sql,2)
		If Not Rs.Eof Then AClassID=Rs(0)-1
		Rs.Close
		ClassParentStr=""
		ClassOrder=-1
		cFir=0
		Call Exec(trs,"Select * from "&Data_Name&" Where ChannelID=" & ChannelID & " and ClassParent=" & Code_Form("ClassID") & " and ClassName='" & Code_Admin("ClassName",1,20) & "'",2)
		If Not (trs.BOF And trs.EOF) Then
			FoundErr = True
			If Code_Form("ClassID") = 0 Then
				Response.Write "{""code"":0,""msg"":""\u5df2\u7ecf\u5b58\u5728\u4e00\u7ea7\u680f\u76ee\uff1a" & ToUnicode(Code_Admin("ClassName",1,20)) & """}" & vbCrLf
				Response.End()
			Else
				Call Exec(rs,"select * from "&Data_Name&" where ClassID=" & Code_Form("ClassID") & "",2)
				If rs.BOF And rs.EOF Then
					Response.Write "{""code"":0,""msg"":""\u6240\u5c5e\u680f\u76ee\u5df2\u7ecf\u88ab\u5220\u9664\uff01""}" & vbCrLf
					Response.End()
					rs.Close
					Set rs = Nothing
					Exit Sub
				End If
				ParentName = rs("ClassName")
				rs.Close
				Set rs = Nothing
				Response.Write "{""code"":0,""msg"":""\u201c" & ToUnicode(ParentName) & "\u201d\u4e2d\u5df2\u7ecf\u5b58\u5728\u5b50\u680f\u76ee\u201c" & ToUnicode(Code_Admin("ClassName",1,20)) & "\u201d\uff01""}" & vbCrLf
				Response.End()
			End If
		End If
		trs.Close
		Set trs = Nothing
		AClassID=0
		ClassID=Code_Form("ClassID")
		If Not Is_Int(ClassID) Then ClassID=0
		If Int(ClassID)<1 Then
			Sql="Select Top 1 AClassID From "&Data_Name&" Where ChannelID="&ChannelID&" Order By AClassID Desc"
			Call Exec(Rs,Sql,2)
			If Not Rs.Eof Then AClassID=Rs(0)
			Rs.Close
			AClassID=AClassID+1
		Else
			Sql="Select Top 1 AClassID,ClassOrder,ClassDepth,ClassParentStr,HtmlFileDir From "&Data_Name&" Where ChannelID="&ChannelID&" And ClassID="&ClassID
			Call Exec(Rs,Sql,2)
			If Rs.Eof Then
				Rs.Close
				Response.Write "{""code"":0,""msg"":""\u6240\u5c5e\u680f\u76eeID\uff08"&ClassID&"\uff09\u4e0d\u5b58\u5728\uff01""}" & vbCrLf
				Response.End()
				Exit Sub
			End If
			AClassID=Rs("AClassID")
			ClassOrder=Rs("ClassOrder")
			ClassDepth=Rs("ClassDepth")
			ClassParentStr=Rs("ClassParentStr")
			CHtmlFileDir=Rs("HtmlFileDir")
			Rs.close
			cFir=ClassID
			fo_id=ClassID
			Sql="Select Top 1 ClassID,ClassOrder From "&Data_Name&" Where ChannelID="&ChannelID&" And Left(ClassParentStr,"&(Len(ClassParentStr)+1)&")='"&ClassParentStr&",' Order By ClassOrder Desc"
			Call Exec(Rs,Sql,2)
			If Not Rs.Eof Then
				fo_id=Rs(0)
				ClassOrder=Rs(1)
			End If
			Rs.Close
		End If
		ClassName=Code_Admin("ClassName",1,20)
		ClassPic=Code_Form("ClassPic")
		MetaKeyWord=Code_Form("MetaKeyWord")
		MetaDescript=Code_Form("MetaDescript")
		Moban=Code_Form("Moban")
		SkinID=Code_Form("SkinID")
		TemplateID=Code_Form("TemplateID")
		ContentMoban=Code_Form("ContentMoban")
		ContentSkinID=Code_Form("ContentSkinID")
		ContentTemplateID=Code_Form("ContentTemplateID")
		ImageWidth=Code_Form("ImageWidth")
		ImageHeight=Code_Form("ImageHeight")
		CuteNums=Code_Form("CuteNums")
		Columns=Code_Form("Columns")
		PageNum=Code_Form("PageNum")
		If ClassName="" Then
			Response.Write "{""code"":0,""msg"":""\u680f\u76ee\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a\uff01""}" & vbCrLf
			Response.End()
		End If
		HtmlFileDir = Replace(Replace(Replace(Request.Form("ClassDir"), "\","/"), " ",""), "'","")
		If HtmlFileDir="" Then HtmlFileDir = Get_PinYin(ClassName)
		If Not IsValidChar(HtmlFileDir) Then
			Response.Write "{""code"":0,""msg"":""\u680f\u76eeu76ee\u5f55\u4e3a\u7a7a\u6216\u8005\u542b\u6709\u975e\u82f1\u6587\u5b57\u7b26\uff01""}" & vbCrLf
			Response.End()
		End If
		If Right(HtmlFileDir, 1) <> "/" Then
			HtmlFileDir = HtmlFileDir
		Else
			HtmlFileDir = Left(HtmlFileDir,Len(HtmlFileDir)-1)
		End If
		If Left(HtmlFileDir, 1) = "/" Then
			Response.Write "{""code"":0,""msg"":""\u76ee\u5f55\u524d\u9762\u4e0d\u80fd\u6709\u201c\/\u201d\uff0c\u8bf7\u8ba4\u771f\u586b\u5199\u680f\u76eeu76ee\u5f55\uff01""}" & vbCrLf
			Response.End()
		End If
		If ImageWidth="" or IsNumeric(ImageWidth)=False Then ImageWidth = 180
		If ImageHeight="" or IsNumeric(ImageHeight)=False Then ImageHeight = 120
		If CuteNums="" or IsNumeric(CuteNums)=False Then CuteNums = 0
		If Columns="" or IsNumeric(Columns)=False Then Columns = 1
		If PageNum="" or IsNumeric(PageNum)=False Then PageNum = 0
		If FoundErr=True Then
			Exit Sub
		End If
		If Int(ClassID)>0 Then
			Sql="Select Top 1 ClassOrder From "&Data_Name&" Where ChannelID="&ChannelID&" And AClassID="&AClassID&" And ClassParent="&fo_id&" Order By ClassOrder Desc"
			Call Exec(Rs,Sql,2)
			If Not Rs.Eof Then ClassOrder=Rs(0)
			Rs.Close
			If Int(ClassID)>0 Then Call Exec("","Update "&Data_Name&" Set ClassOrder=ClassOrder+1 Where ChannelID="&ChannelID&" And AClassID="&AClassID&" And ClassOrder>"&ClassOrder,0)
		End If
		ClassID = GetNewID(Data_Name, "ClassID")
		Sql="Select * From "&Data_Name
		Call Exe_Conn(Rs,Sql,3)
		Rs.AddNew
		Rs("ClassID")=ClassID
		Rs("AClassID")=AClassID
		Rs("ClassOrder")=ClassOrder+1
		Rs("ClassParent")=cFir
		Rs("ClassChild")=0
		If Int(cFir)=0 Then
			Rs("ClassDepth")=0
		Else
			Rs("ClassDepth")=ClassDepth+1
		End If
		Rs("ClassName")=ClassName
		Rs("ChannelID")=ChannelID
		Rs("ClassDir")=Trim(HtmlFileDir)
		HtmlFileDir = CHtmlFileDir & HtmlFileDir & "/"
		Rs("HtmlFileDir")=Trim(HtmlFileDir)
		Rs("ClassPic")=ClassPic
		Rs("MetaKeyWord")=MetaKeyWord
		Rs("MetaDescript")=MetaDescript
		Rs("IsUpdate")=True
		Rs("Moban")=Moban
		Rs("SkinID")=SkinID
		Rs("TemplateID")=TemplateID
		Rs("ContentMoban")=ContentMoban
		Rs("ContentSkinID")=ContentSkinID
		Rs("ContentTemplateID")=ContentTemplateID
		Rs("ImageWidth")=ImageWidth
		Rs("ImageHeight")=ImageHeight
		Rs("CuteNums")=CuteNums
		Rs("Columns")=Columns
		Rs("PageNum")=PageNum
		Rs.Update
		Rs.Close
		firid=first_id(Data_Name,"ClassID")
		If Is_Null(ClassParentStr)<>"" Then
			Call Exec("","Update "&Data_Name&" Set ClassParentStr='"&ClassParentStr&","&firid&"' Where ChannelID="&ChannelID&" And ClassID="&firid,0)
		Else
			Call Exec("","Update "&Data_Name&" Set ClassParentStr='"&firid&"' Where ChannelID="&ChannelID&" And ClassID="&firid,0)
		End If
		If Is_Null(ClassParentStr)<>"" Then
			Call Exec("","Update "&Data_Name&" Set ClassChild=ClassChild+1 Where ChannelID="&ChannelID&" And AClassID="&AClassID&" And ClassID in ("&ClassParentStr&")",0)
		End If
		
		'更新子栏目
		If Is_Null(ClassParentStr)<>"" Then
		Call Exec("","Update "&Data_Name&" Set ClassChildStr=ClassChildStr+',"&firid&"' Where ChannelID="&ChannelID&" And AClassID="&AClassID&" And ClassID in ("&ClassParentStr&")",0)
		End If
		Call Exec("","Update "&Data_Name&" Set ClassChildStr='"&firid&"' Where ChannelID="&ChannelID&" And ClassID="&firid,0)
		'创建目录
		If ChannelIsCreateHtml = True Then
			'If ClassID <> "0" Then
				'Sql = "Select * From "&Data_Name&" Where ClassID="&ClassID
				'Call Exec(Rs,Sql,2)
				'Set Cfs=New Cls_FileSystem
				'If Cfs.Chk_Exist(InstallDir & ChannelDir & "/" & Trim(Rs("ClassDir")),0)=False Then Cfs.Make_Dir(InstallDir & ChannelDir & "/" & Trim(Rs("ClassDir")))
				'Set Cfs=Nothing
				'Rs.Close
			'End If
			Dim Cfs
			Set Cfs=New Cls_FileSystem
			If Cfs.Chk_Exist(InstallDir & ChannelDir & "/" & Trim(HtmlFileDir),0)=False Then Cfs.Make_Dir(InstallDir & ChannelDir & "/" & Trim(HtmlFileDir))
			Set Cfs=Nothing
		End If
		'If ChannelIsCreateHtml = True Then Response.Write "<iframe id='CreateClass' width='100%' height='210' frameborder='0' src='Admin_CreateClass.asp?Action=ListCont&ChannelID=" & ChannelID & "&ClassID=" & ClassID & "'></iframe>"
		'Response.Write IsConfirm("成功添加一个新的栏目（"&ClassName&"）！请点击确定，需要继续添加点击取消！",AdminFolder & "/Admin/" & strFileName & "?ChannelID="&ChannelID&"",AdminFolder & "/Admin/" & strFileName & "?Action=Add&ChannelID="&ChannelID&"&Pid="&Pid&"")
		Response.Write "{""code"":1,""msg"":""\u6210\u529f\u6dfb\u52a0\u4e00\u4e2a\u65b0\u7684\u680f\u76ee\uff08"&ClassName&"\uff09\uff01"",""ChannelID"":"&ChannelID&",""ClassID"":"&ClassID&",""url"":""?ChannelID="&ChannelID&"""}" & vbCrLf
		Response.End()
		Exit Sub
	End If
End Sub

Sub Class_AddMore()
	Response.Write "<!DOCTYPE html>" & vbCrLf
	Response.Write "<head>" & vbCrLf
	Response.Write "<title>栏目列表</title>" & vbCrlf
	Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" & vbCrLf
	Response.Write "<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-status-bar-style' content='black'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-capable' content='yes'>" & vbCrLf
	Response.Write "<meta name='format-detection' content='telephone=no'>" & vbCrLf
	Response.Write "<link rel=""stylesheet"" type=""text/css"" href=""../fonts/font-awesome/css/font-awesome.min.css"" />" & vbCrLf
	Response.Write "<link href='../Plugins/layui/css/layui.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link href='../Style/global.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link href='../Style/font.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<script type='text/javascript'>" & vbCrLf
	Response.Write "var pc_file = '" & InstallDir & "';" & vbCrLf
	Response.Write "var admin_file = '" & AdminFolder & "/';" & vbCrLf
	Response.Write "</script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../Js/Admin.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/main.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcore.min.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcalendar.min.js'></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/layui/layui.js""></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/xm-select/xm-select.js""></script>" & vbCrLf
	Response.Write "</head>" & vbCrlf
	Response.Write "<body>" & vbCrlf
	Dim Pid
	Pid=Code_ID("Pid")
	Response.Write "<form class='layui-form layui-form-pane' id=""myform"" name=""myform"" action='?Action=SaveAddMore&ChannelID=" & ChannelID & "&ClassID=" & ClassID & "&Pid=" & Pid & "' method=post>" & vbCrlf
	Response.Write "<div class=""admin-main fadeInUp animated"">" & vbCrlf
	Response.Write "    <fieldset class=""layui-elem-field layui-field-title"">" & vbCrlf
	Response.Write "        <legend>批量添加栏目</legend>" & vbCrlf
	Response.Write "    </fieldset>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">栏目名称：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-3"">" & vbCrlf
	Response.Write "            <textarea name='ClassName' id='ClassName' cols='60' rows='5' lay-verify=""ClassName"" class=""layui-textarea""></textarea>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "        <div class=""layui-input-4"" style=""line-height: 30px;"">" & vbCrlf
	Response.Write "            例如：<br>" & vbCrlf
	Response.Write "            国内新闻|china<br>" & vbCrlf
	Response.Write "            国际新闻|world<br>" & vbCrlf
	Response.Write "            竖线以及后面的英文名可留空，默认会自动生成栏目的拼音" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">上级栏目：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	Response.Write "            <div id=""ClassID"" class=""xm-select-demo""></div>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">栏目图片：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-2"">" & vbCrlf
	Response.Write "            <input id='ClassPic' name='ClassPic' type='text' value='' size='30' maxlength='255' class=""layui-input"">" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "        <div class=""layui-input-2"">" & vbCrlf
	Response.Write "            <button type=""button"" class=""layui-btn"" hidefocus=""true"" onclick=""UploadFile('"&ChannelID&"','"&ChannelModuleType&"','1','0','"&ClassID&"','1','0','0','ClassPic','','','','','" & InstallDir & UploadSetting(1) & "','" & UploadSetting(1) & "','" & InstallDir & "','" & InstallDir & UploadSetting(1) & "/" & ChannelDir & "','/" & ChannelDir & "');"">上传</button>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item layui-form-text"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">栏目META关键词：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-block"">" & vbCrlf
	Response.Write "            <textarea name='MetaKeyWord' id='MetaKeyWord' cols='60' rows='5' class=""layui-textarea""></textarea>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item layui-form-text"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">栏目META网页描述：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-block"">" & vbCrlf
	Response.Write "            <textarea name='MetaDescript' id='MetaDescript' cols='60' rows='5' class=""layui-textarea""></textarea>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <div class=""layui-inline"">" & vbCrlf
	Response.Write "            <label class=""layui-form-label"">截断字数：</label>" & vbCrlf
	Response.Write "            <div class=""layui-input-inline"">" & vbCrlf
	Response.Write "                <input type='number' min=""0"" id='CuteNums' name='CuteNums' value='' size='5' maxlength='20' class=""layui-input"">" & vbCrlf
	Response.Write "            </div>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <div class=""layui-inline"">" & vbCrlf
	Response.Write "            <label class=""layui-form-label"">每行几个：</label>" & vbCrlf
	Response.Write "            <div class=""layui-input-inline"">" & vbCrlf
	Response.Write "                <input type='number' min=""1"" id='Columns' name='Columns' value='' size='5' maxlength='20' class=""layui-input"">" & vbCrlf
	Response.Write "            </div>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <div class=""layui-inline"">" & vbCrlf
	Response.Write "            <label class=""layui-form-label"">分页：</label>" & vbCrlf
	Response.Write "            <div class=""layui-input-inline"">" & vbCrlf
	Response.Write "                <input type='number' min=""0"" id='PageNum' name='PageNum' value='20' size='5' maxlength='20' class=""layui-input"">" & vbCrlf
	Response.Write "            </div>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "<fieldset class=""layui-elem-field"">" & vbCrlf
	Response.Write "<legend>图片属性：</legend>" & vbCrlf
	Response.Write "<div class=""layui-field-box"">" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <div class=""layui-inline"">" & vbCrlf
	Response.Write "            <label class=""layui-form-label"">图片宽度：</label>" & vbCrlf
	Response.Write "            <div class=""layui-input-inline"">" & vbCrlf
	Response.Write "                <input type='number' min=""0"" id='ImageWidth' name='ImageWidth' value='' size='5' maxlength='20' class=""layui-input"">" & vbCrlf
	Response.Write "            </div>" & vbCrlf
	Response.Write "            <div class=""layui-form-mid layui-word-aux"">px</div>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "        <div class=""layui-inline"">" & vbCrlf
	Response.Write "            <label class=""layui-form-label"">图片高度：</label>" & vbCrlf
	Response.Write "            <div class=""layui-input-inline"">" & vbCrlf
	Response.Write "                <input type='number' min=""0"" id='ImageHeight' name='ImageHeight' value='' size='5' maxlength='20' class=""layui-input"">" & vbCrlf
	Response.Write "            </div>" & vbCrlf
	Response.Write "            <div class=""layui-form-mid layui-word-aux"">px</div>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "</div>" & vbCrlf
	Response.Write "</fieldset>" & vbCrlf
	'Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	'Response.Write "        <label class=""layui-form-label"">栏目模板：</label>" & vbCrlf
	'Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	'Response.Write "            " & Admin_ShowMoban_Option("","Moban","list",ChannelID) & "" & vbCrlf
	'Response.Write "        </div>" & vbCrlf
	'Response.Write "    </div>" & vbCrlf
	'Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	'Response.Write "        <label class=""layui-form-label"">栏目风格：</label>" & vbCrlf
	'Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	'Response.Write "            " & Admin_ShowSkin_Option("","SkinID",6) & "" & vbCrlf
	'Response.Write "        </div>" & vbCrlf
	'Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">栏目模板：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-inline"">" & vbCrlf
	Response.Write "            <input type='text' id='Moban' name='Moban' value='' size='40' maxlength='255' class='layui-input' readonly=""readonly"">" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "        <div class=""layui-input-block"">" & vbCrlf
	Response.Write "            <button type=""button"" class=""layui-btn"" hidefocus=""true"" onclick=""SelectMoban('" & ChannelID & "','Moban');"">选择模板</button><button type=""button"" class=""layui-btn layui-btn-danger"" hidefocus=""true"" onclick=""ClearColor('Moban');"">清空</button>&nbsp;&nbsp;可以为空" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">栏目风格：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-inline"">" & vbCrlf
	Response.Write "            <input type='text' id='SkinID' name='SkinID' value='' size='40' maxlength='255' class='layui-input' readonly=""readonly"">" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "        <div class=""layui-input-block"">" & vbCrlf
	Response.Write "            <button type=""button"" class=""layui-btn"" hidefocus=""true"" onclick=""SelectCss('SkinID');"">选择风格</button><button type=""button"" class=""layui-btn layui-btn-danger"" hidefocus=""true"" onclick=""ClearColor('SkinID');"">清空</button>&nbsp;&nbsp;可以为空" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	'Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	'Response.Write "        <label class=""layui-form-label"">页面框架：</label>" & vbCrlf
	'Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	'Response.Write "            " & Admin_ShowTemplate_Option(0,"TemplateID",2,ChannelID) & "" & vbCrlf
	'Response.Write "        </div>" & vbCrlf
	'Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label""><font color='#FF0000'>内容模板：</font></label>" & vbCrlf
	Response.Write "        <div class=""layui-input-inline"">" & vbCrlf
	Response.Write "            <input type='text' id='ContentMoban' name='ContentMoban' value='' size='40' maxlength='255' class='layui-input' readonly=""readonly"">" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "        <div class=""layui-input-block"">" & vbCrlf
	Response.Write "            <button type=""button"" class=""layui-btn"" hidefocus=""true"" onclick=""SelectMoban('" & ChannelID & "','ContentMoban');"">选择模板</button><button type=""button"" class=""layui-btn layui-btn-danger"" hidefocus=""true"" onclick=""ClearColor('ContentMoban');"">清空</button>&nbsp;&nbsp;可以为空" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label""><font color='#FF0000'>内容风格：</font></label>" & vbCrlf
	Response.Write "        <div class=""layui-input-inline"">" & vbCrlf
	Response.Write "            <input type='text' id='ContentSkinID' name='ContentSkinID' value='' size='40' maxlength='255' class='layui-input' readonly=""readonly"">" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "        <div class=""layui-input-block"">" & vbCrlf
	Response.Write "            <button type=""button"" class=""layui-btn"" hidefocus=""true"" onclick=""SelectCss('ContentSkinID');"">选择风格</button><button type=""button"" class=""layui-btn layui-btn-danger"" hidefocus=""true"" onclick=""ClearColor('ContentSkinID');"">清空</button>&nbsp;&nbsp;可以为空" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	'Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	'Response.Write "        <label class=""layui-form-label""><font color='#FF0000'>内容框架：</font></label>" & vbCrlf
	'Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	'Response.Write "            " & Admin_ShowTemplate_Option(0,"ContentTemplateID",3,ChannelID) & "" & vbCrlf
	'Response.Write "        </div>" & vbCrlf
	'Response.Write "    </div>" & vbCrlf
	Response.Write "</div>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<input name=""ChannelID"" type=""hidden"" id=""ChannelID"" value=""" & ChannelID & """>" & Submit_Layui("提交添加","重新填写","确认要清空对话框内容？","javascript:history.back();","返回上一页","") & vbCrlf
	Response.Write "</form>" & vbCrlf
	Response.Write "<script>" & vbCrlf
	Response.Write "layui.use(['form'], function () {" & vbCrlf
	Response.Write "    var form = layui.form;" & vbCrlf
	Response.Write "    //自定义表单验证" & vbCrlf
	Response.Write "    form.verify({" & vbCrlf
	Response.Write "        ClassName: function (value, item) {" & vbCrlf
	Response.Write "            if (!value){" & vbCrlf
	Response.Write "                item.focus();" & vbCrlf
	Response.Write "                return ""栏目名称不能为空！"";" & vbCrlf
	Response.Write "            }" & vbCrlf
	Response.Write "        }," & vbCrlf
	Response.Write "        ClassID: function (value, item) {" & vbCrlf
	Response.Write "            if (!value){" & vbCrlf
	Response.Write "                item.focus();" & vbCrlf
	Response.Write "                return ""请选择" & ChannelTit & "栏目！"";" & vbCrlf
	Response.Write "            }" & vbCrlf
	Response.Write "        }," & vbCrlf
	Response.Write "    })" & vbCrLf
	Response.Write "    var ClassID = xmSelect.render({" & vbCrLf
	Response.Write "        el: '#ClassID'," & vbCrLf
	Response.Write "        name: 'ClassID'," & vbCrLf
	Response.Write "        layVerify: 'ClassID'," & vbCrLf
	Response.Write "        radio: true," & vbCrLf
	Response.Write "        clickClose: true," & vbCrLf
	'Response.Write "        tips: '指定栏目的" & ChannelTit & "?'," & vbCrLf
	'Response.Write "        empty: '呀, 没有数据呢'," & vbCrLf
	Response.Write "        autoRow: true," & vbCrLf
	Response.Write "        filterable: true," & vbCrLf
	Response.Write "        height: '300px'," & vbCrLf
	Response.Write "        direction: 'down'," & vbCrLf
	Response.Write "        tree: {" & vbCrLf
	Response.Write "            show: true,//是否显示树状结构" & vbCrLf
	Response.Write "            showFolderIcon: true,//是否展示三角图标" & vbCrLf
	Response.Write "            showLine: true,//是否显示虚线" & vbCrLf
	Response.Write "            indent: 20,//间距" & vbCrLf
	Response.Write "            expandedKeys: true,//默认展开节点的数组, 为 true 时, 展开所有节点" & vbCrLf
	Response.Write "            strict: false,//是否严格遵守父子模式" & vbCrLf
	Response.Write "        }," & vbCrLf
	Response.Write "        toolbar: {" & vbCrLf
	Response.Write "            show: false," & vbCrLf
	Response.Write "            list: ['ALL', 'REVERSE', 'CLEAR']" & vbCrLf
	Response.Write "        }," & vbCrLf
	Response.Write "        data: [" & vbCrLf
	Response.Write "            {name: '作为一级栏目', value: 0"
	If Int(Pid)=Int(0) Then Response.Write ", selected: true"
	Response.Write "}," & vbCrLf
	Response.Write GetClass_Option(ChannelID, 0, Pid)
	Response.Write "        ]" & vbCrLf
	Response.Write "    })" & vbCrLf
	Response.Write "    //提交监听" & vbCrlf
	Response.Write "    form.on('submit(submit)', function (data) {" & vbCrlf
	Response.Write "        loading = layer.load(1, {shade: [0.1,'#fff']});" & vbCrlf
	Response.Write "        $.ajax({" & vbCrLf
	Response.Write "            type: 'post'," & vbCrLf
	Response.Write "            url: '?Action=SaveAddMore'," & vbCrLf
	Response.Write "            data: data.field," & vbCrLf
	Response.Write "            dataType: 'json'," & vbCrLf
	Response.Write "            success: function(res) {" & vbCrLf
	Response.Write "                layer.close(loading);" & vbCrlf
	Response.Write "                if(res.code > 0){" & vbCrlf
	If ChannelIsCreateHtml = True Then
		Response.Write "                    var diag = new Dialog({" & vbCrlf
		Response.Write "                        id:'CreateClass'," & vbCrlf
		Response.Write "                        title:'正在生成相关数据'," & vbCrlf
		Response.Write "                        url:'" & InstallDir & AdminFolder & "/" & ChannelDir & "/Admin_Create" & ChannelDir & ".asp?Action=ListCont&ClassList=1&ChannelID='+res.ChannelID+'&Csid='+res.ClassID+''," & vbCrlf
		Response.Write "                        width:450," & vbCrlf
		Response.Write "                        height:200," & vbCrlf
		Response.Write "                        modal:true" & vbCrlf
		Response.Write "                    });" & vbCrlf
		Response.Write "                    diag.autoClose=1;" & vbCrlf
		Response.Write "                    diag.show();" & vbCrlf
		Response.Write "                    setTimeout(function(){" & vbCrlf
		Response.Write "                        layer.msg(res.msg,{icon: 1, time: 1000},function(){" & vbCrlf
		Response.Write "                            location.href = res.url;" & vbCrlf
		Response.Write "                        });" & vbCrlf
		Response.Write "                    },1500);" & vbCrlf
	Else
		Response.Write "                    layer.msg(res.msg,{icon: 1, time: 1000},function(){" & vbCrlf
		Response.Write "                        location.href = res.url;" & vbCrlf
		Response.Write "                    });" & vbCrlf
	End If
	Response.Write "                }else{" & vbCrlf
	Response.Write "                    layer.msg(res.msg,{icon: 2, time: 1000});" & vbCrlf
	Response.Write "                }" & vbCrlf
	Response.Write "            }" & vbCrLf
	Response.Write "        });" & vbCrLf
	Response.Write "    });" & vbCrlf
	Response.Write "});" & vbCrlf
	Response.Write "</script>" & vbCrlf
	Response.Write "</body>" & vbCrLf & "</html>"
End Sub

Sub SaveAddMore()
	If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
		Dim ImageWidth,ImageHeight,CuteNums,Columns,PageNum
		Dim ClassName,ClassDir,ClassPic,cFir,ClassDepth,ClassParentStr,ClassOrder,fo_id,firid,HtmlFileDir,CHtmlFileDir,MetaKeyWord,MetaDescript,Moban,SkinID,TemplateID,ContentMoban,ContentSkinID,ContentTemplateID
		ClassName=Code_Form("ClassName")
		If len(ClassName)=0 Then
			Response.Write "{""code"":0,""msg"":""\u680f\u76ee\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a\uff01""}" & vbCrLf
			Response.End()
		End If
		If ClassName="" Then
			Response.Write "{""code"":0,""msg"":""\u680f\u76ee\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a\uff01""}" & vbCrLf
			Response.End()
		End If
		ClassName=replace(ClassName,chr(13),"")
		t1=split(ClassName,chr(10))
		for i=0 to ubound(t1)
			if instr(t1(i),"|")>0 then
				cname=split(t1(i),"|")
				c_0=trim(cname(0))
				c_1=trim(cname(1))
			else
				c_0=trim(t1(i))
				c_1=""
			end if
			AClassID=1
			ChannelID=Trim(Request.Form("ChannelID"))
			Sql="Select Top 1 AClassID From "&Data_Name&" Where ChannelID="&ChannelID&" Order By AClassID"
			Call Exec(Rs,Sql,2)
			If Not Rs.Eof Then AClassID=Rs(0)-1
			Rs.Close
			ClassParentStr=""
			ClassOrder=-1
			cFir=0
			Call Exec(trs,"Select * from "&Data_Name&" Where ChannelID=" & ChannelID & " and ClassParent=" & Code_Form("ClassID") & " and ClassName='" & c_0 & "'",2)
			If Not (trs.BOF And trs.EOF) Then
				FoundErr = True
				If Code_Form("ClassID") = 0 Then
					Response.Write "{""code"":0,""msg"":""\u5df2\u7ecf\u5b58\u5728\u4e00\u7ea7\u680f\u76ee\uff1a" & ToUnicode(c_0) & """}" & vbCrLf
					Response.End()
				Else
					Call Exec(rs,"select * from "&Data_Name&" where ClassID=" & Code_Form("ClassID") & "",2)
					If rs.BOF And rs.EOF Then
						Response.Write "{""code"":0,""msg"":""\u6240\u5c5e\u680f\u76ee\u5df2\u7ecf\u88ab\u5220\u9664\uff01""}" & vbCrLf
						Response.End()
						rs.Close
						Set rs = Nothing
						Exit Sub
					End If
					ParentName = rs("ClassName")
					rs.Close
					Set rs = Nothing
					Response.Write "{""code"":0,""msg"":""\u201c" & ToUnicode(ParentName) & "\u201d\u4e2d\u5df2\u7ecf\u5b58\u5728\u5b50\u680f\u76ee\u201c" & ToUnicode(c_0) & "\u201d\uff01""}" & vbCrLf
					Response.End()
				End If
			End If
			trs.Close
			Set trs = Nothing
			AClassID=0
			ClassID=Code_Form("ClassID")
			If Not Is_Int(ClassID) Then ClassID=0
			If Int(ClassID)<1 Then
				Sql="Select Top 1 AClassID From "&Data_Name&" Where ChannelID="&ChannelID&" Order By AClassID Desc"
				Call Exec(Rs,Sql,2)
				If Not Rs.Eof Then AClassID=Rs(0)
				Rs.Close
				AClassID=AClassID+1
			Else
				Sql="Select Top 1 AClassID,ClassOrder,ClassDepth,ClassParentStr,HtmlFileDir From "&Data_Name&" Where ChannelID="&ChannelID&" And ClassID="&ClassID
				Call Exec(Rs,Sql,2)
				If Rs.Eof Then
					Rs.Close
					Response.Write "{""code"":0,""msg"":""\u6240\u5c5e\u680f\u76eeID\uff08"&ClassID&"\uff09\u4e0d\u5b58\u5728\uff01""}" & vbCrLf
					Response.End()
					Exit Sub
				End If
				AClassID=Rs("AClassID")
				ClassOrder=Rs("ClassOrder")
				ClassDepth=Rs("ClassDepth")
				ClassParentStr=Rs("ClassParentStr")
				CHtmlFileDir=Rs("HtmlFileDir")
				Rs.close
				cFir=ClassID
				fo_id=ClassID
				Sql="Select Top 1 ClassID,ClassOrder From "&Data_Name&" Where ChannelID="&ChannelID&" And Left(ClassParentStr,"&(Len(ClassParentStr)+1)&")='"&ClassParentStr&",' Order By ClassOrder Desc"
				Call Exec(Rs,Sql,2)
				If Not Rs.Eof Then
					fo_id=Rs(0)
					ClassOrder=Rs(1)
				End If
				Rs.Close
			End If
			ClassPic=Code_Form("ClassPic")
			MetaKeyWord=Code_Form("MetaKeyWord")
			MetaDescript=Code_Form("MetaDescript")
			Moban=Code_Form("Moban")
			SkinID=Code_Form("SkinID")
			TemplateID=Code_Form("TemplateID")
			ContentMoban=Code_Form("ContentMoban")
			ContentSkinID=Code_Form("ContentSkinID")
			ContentTemplateID=Code_Form("ContentTemplateID")
			ImageWidth=Code_Form("ImageWidth")
			ImageHeight=Code_Form("ImageHeight")
			CuteNums=Code_Form("CuteNums")
			Columns=Code_Form("Columns")
			PageNum=Code_Form("PageNum")
			HtmlFileDir = Replace(Replace(Replace(c_1, "\","/"), " ",""), "'","")
			If HtmlFileDir="" Then HtmlFileDir = Get_PinYin(c_0)
			If Not IsValidChar(HtmlFileDir) Then
				Response.Write "{""code"":0,""msg"":""\u680f\u76eeu76ee\u5f55\u4e3a\u7a7a\u6216\u8005\u542b\u6709\u975e\u82f1\u6587\u5b57\u7b26\uff01""}" & vbCrLf
				Response.End()
			End If
			If Right(HtmlFileDir, 1) <> "/" Then
				HtmlFileDir = HtmlFileDir
			Else
				HtmlFileDir = Left(HtmlFileDir,Len(HtmlFileDir)-1)
			End If
			If Left(HtmlFileDir, 1) = "/" Then
				Response.Write "{""code"":0,""msg"":""\u76ee\u5f55\u524d\u9762\u4e0d\u80fd\u6709\u201c\/\u201d\uff0c\u8bf7\u8ba4\u771f\u586b\u5199\u680f\u76eeu76ee\u5f55\uff01""}" & vbCrLf
				Response.End()
			End If
			If ImageWidth="" or IsNumeric(ImageWidth)=False Then ImageWidth = 180
			If ImageHeight="" or IsNumeric(ImageHeight)=False Then ImageHeight = 120
			If CuteNums="" or IsNumeric(CuteNums)=False Then CuteNums = 0
			If Columns="" or IsNumeric(Columns)=False Then Columns = 1
			If PageNum="" or IsNumeric(PageNum)=False Then PageNum = 0
			If FoundErr=True Then
				Exit Sub
			End If
			If Int(ClassID)>0 Then
				Sql="Select Top 1 ClassOrder From "&Data_Name&" Where ChannelID="&ChannelID&" And AClassID="&AClassID&" And ClassParent="&fo_id&" Order By ClassOrder Desc"
				Call Exec(Rs,Sql,2)
				If Not Rs.Eof Then ClassOrder=Rs(0)
				Rs.Close
				If Int(ClassID)>0 Then Call Exec("","Update "&Data_Name&" Set ClassOrder=ClassOrder+1 Where ChannelID="&ChannelID&" And AClassID="&AClassID&" And ClassOrder>"&ClassOrder,0)
			End If
			ClassID = GetNewID(Data_Name, "ClassID")
			Sql="Select * From "&Data_Name
			Call Exe_Conn(Rs,Sql,3)
			Rs.AddNew
			Rs("ClassID")=ClassID
			Rs("AClassID")=AClassID
			Rs("ClassOrder")=ClassOrder+1
			Rs("ClassParent")=cFir
			Rs("ClassChild")=0
			If Int(cFir)=0 Then
				Rs("ClassDepth")=0
			Else
				Rs("ClassDepth")=ClassDepth+1
			End If
			Rs("ClassName")=c_0
			Rs("ChannelID")=ChannelID
			Rs("ClassDir")=Trim(HtmlFileDir)
			HtmlFileDir = CHtmlFileDir & HtmlFileDir & "/"
			Rs("HtmlFileDir")=Trim(HtmlFileDir)
			Rs("ClassPic")=ClassPic
			Rs("MetaKeyWord")=MetaKeyWord
			Rs("MetaDescript")=MetaDescript
			Rs("IsUpdate")=True
			Rs("Moban")=Moban
			Rs("SkinID")=SkinID
			Rs("TemplateID")=TemplateID
			Rs("ContentMoban")=ContentMoban
			Rs("ContentSkinID")=ContentSkinID
			Rs("ContentTemplateID")=ContentTemplateID
			Rs("ImageWidth")=ImageWidth
			Rs("ImageHeight")=ImageHeight
			Rs("CuteNums")=CuteNums
			Rs("Columns")=Columns
			Rs("PageNum")=PageNum
			Rs.Update
			Rs.Close
			firid=first_id(Data_Name,"ClassID")
			If Is_Null(ClassParentStr)<>"" Then
				Call Exec("","Update "&Data_Name&" Set ClassParentStr='"&ClassParentStr&","&firid&"' Where ChannelID="&ChannelID&" And ClassID="&firid,0)
			Else
				Call Exec("","Update "&Data_Name&" Set ClassParentStr='"&firid&"' Where ChannelID="&ChannelID&" And ClassID="&firid,0)
			End If
			If Is_Null(ClassParentStr)<>"" Then
				Call Exec("","Update "&Data_Name&" Set ClassChild=ClassChild+1 Where ChannelID="&ChannelID&" And AClassID="&AClassID&" And ClassID in ("&ClassParentStr&")",0)
			End If
			
			'更新子栏目
			If Is_Null(ClassParentStr)<>"" Then
			Call Exec("","Update "&Data_Name&" Set ClassChildStr=ClassChildStr+',"&firid&"' Where ChannelID="&ChannelID&" And AClassID="&AClassID&" And ClassID in ("&ClassParentStr&")",0)
			End If
			Call Exec("","Update "&Data_Name&" Set ClassChildStr='"&firid&"' Where ChannelID="&ChannelID&" And ClassID="&firid,0)
			'创建目录
			If ChannelIsCreateHtml = True Then
				'If ClassID <> "0" Then
					'Sql = "Select * From "&Data_Name&" Where ClassID="&ClassID
					'Call Exec(Rs,Sql,2)
					'Set Cfs=New Cls_FileSystem
					'If Cfs.Chk_Exist(InstallDir & ChannelDir & "/" & Trim(Rs("ClassDir")),0)=False Then Cfs.Make_Dir(InstallDir & ChannelDir & "/" & Trim(Rs("ClassDir")))
					'Set Cfs=Nothing
					'Rs.Close
				'End If
				Dim Cfs
				Set Cfs=New Cls_FileSystem
				If Cfs.Chk_Exist(InstallDir & ChannelDir & "/" & Trim(HtmlFileDir),0)=False Then Cfs.Make_Dir(InstallDir & ChannelDir & "/" & Trim(HtmlFileDir))
				Set Cfs=Nothing
			End If
			If Csid = "" Then
				Csid = ClassID
			Else
				Csid = Csid & "," & ClassID
			End If
		next
		'If ChannelIsCreateHtml = True Then Response.Write "<iframe id='CreateClass' width='100%' height='210' frameborder='0' src='Admin_CreateClass.asp?Action=ListCont&ChannelID=" & ChannelID & "&ClassID=" & ClassID & "'></iframe>"
		'Response.Write IsConfirm("成功添加一个新的栏目（"&ClassName&"）！请点击确定，需要继续添加点击取消！",AdminFolder & "/Admin/" & strFileName & "?ChannelID="&ChannelID&"",AdminFolder & "/Admin/" & strFileName & "?Action=Add&ChannelID="&ChannelID&"&Pid="&Pid&"")
		Response.Write "{""code"":1,""msg"":""\u6279\u91cf\u6dfb\u52a0\u6210\u529f\uff01"",""ChannelID"":"&ChannelID&",""ClassID"":"""&Csid&""",""url"":""?ChannelID="&ChannelID&"""}" & vbCrLf
		Response.End()
		Exit Sub
	End If
End Sub

Sub Class_Edit()
	Response.Write "<!DOCTYPE html>" & vbCrLf
	Response.Write "<head>" & vbCrLf
	Response.Write "<title>栏目列表</title>" & vbCrlf
	Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" & vbCrLf
	Response.Write "<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-status-bar-style' content='black'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-capable' content='yes'>" & vbCrLf
	Response.Write "<meta name='format-detection' content='telephone=no'>" & vbCrLf
	Response.Write "<link rel=""stylesheet"" type=""text/css"" href=""../fonts/font-awesome/css/font-awesome.min.css"" />" & vbCrLf
	Response.Write "<link href='../Plugins/layui/css/layui.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link href='../Style/global.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link href='../Style/font.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<script type='text/javascript'>" & vbCrLf
	Response.Write "var pc_file = '" & InstallDir & "';" & vbCrLf
	Response.Write "var admin_file = '" & AdminFolder & "/';" & vbCrLf
	Response.Write "</script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../Js/Admin.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/main.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcore.min.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcalendar.min.js'></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/layui/layui.js""></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/xm-select/xm-select.js""></script>" & vbCrLf
	Response.Write "</head>" & vbCrlf
	Response.Write "<body>" & vbCrlf
	Dim rs3
	Dim funder,ftrue,fir_true,fDepth,ImageWidth,ImageHeight,CuteNums,Columns,PageNum
	Dim ClassName,ClassDir,ClassPic,ClassParent,ClassParentStr,ClassOrder,ClassParentStr2,fDepth2,ClassOrder2,ClassOrders,Moban,SkinID,TemplateID,ContentMoban,ContentSkinID,ContentTemplateID
	Dim forumtype,forumpro,forumhidden,fhidden,rs2,cFir,ccid2,classid2,fhn,HtmlFileDir,CHtmlFileDir,MetaKeyWord,MetaDescript,QHtmlFileDir,QHtmlFileDir2
	fhidden=False
	funder=False
	ftrue=False
	fir_true=false
	Sql="Select Count(ClassID) From "&Data_Name&" Where ChannelID="&ChannelID&" And ClassParent="&ClassID
	Call Exec(Rs,Sql,2)
	If Int(Rs(0))>0 Then funder=True
	Rs.Close
	Sql="Select Top 1 * From "&Data_Name&" Where ChannelID="&ChannelID&" And ClassID="&ClassID
	Call Exe_Conn(Rs,Sql,3)
	If Rs.Eof Then
		Rs.Close
		Response.Write IsSuccess("栏目ID（"&ClassID&"）不存在！",AdminFolder & "/Admin/" & strFileName & "?ChannelID="&ChannelID)
		Exit Sub
	End If
	ClassName=Rs("ClassName")
	ImageWidth=Rs("ImageWidth")
	ImageHeight=Rs("ImageHeight")
	CuteNums=Rs("CuteNums")
	Columns=Rs("Columns")
	PageNum=Rs("PageNum")
	CHtmlFileDir=rs("ClassDir")
	QHtmlFileDir=Trim(rs("HtmlFileDir"))
	ClassPic=rs("ClassPic")
	MetaKeyWord=rs("MetaKeyWord")
	MetaDescript=rs("MetaDescript")
	If QHtmlFileDir<>"" And CHtmlFileDir<>"" Then QHtmlFileDir2=Left(QHtmlFileDir,(len(QHtmlFileDir)-len(CHtmlFileDir)-1))
	If Rs("ClassDepth")=0 And Cstr(Rs("ClassDepth"))="0" Then fir_true=True '一级栏目
	Response.Write "<form class='layui-form layui-form-pane' id=""myform"" name=""myform"" action='?Action=SaveModify&ChannelID=" & ChannelID & "&ClassID=" & ClassID & "' method=post>" & vbCrlf
	Response.Write "<div class=""admin-main fadeInUp animated"">" & vbCrlf
	Response.Write "    <fieldset class=""layui-elem-field layui-field-title"">" & vbCrlf
	Response.Write "        <legend>编辑栏目（" & ClassName & "）</legend>" & vbCrlf
	Response.Write "    </fieldset>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">栏目名称：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	Response.Write "            <input type='text' id='ClassName' name='ClassName' value='" & ClassName & "' size='30' maxlength='20' lay-verify=""ClassName"" class=""layui-input"" onblur=""to_pinyin('ClassDir','ClassName','" & strFileName & "');"">" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">栏目目录：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	Response.Write "            <input id='ClassDir' name='ClassDir' type='text' value='" & CHtmlFileDir & "' size='30' maxlength='255' readonly=""readonly""=""readonly=""readonly"""" class=""layui-input"">" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">上级栏目：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	If funder=True Then
		Response.Write "            <font class='red2'>本栏目有下级栏目，不可更改上级栏目</font><input type='hidden' name='ClassID' value='"&ClassID&"'>" & vbCrlf
	Else
		Response.Write "            <div id=""ClassID"" class=""xm-select-demo""></div>" & vbCrlf
	End If
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">栏目图片：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-2"">" & vbCrlf
	Response.Write "            <input id='ClassPic' name='ClassPic' type='text' value='" & ClassPic & "' size='30' maxlength='255' class=""layui-input"">" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	Response.Write "            <button type=""button"" class=""layui-btn"" hidefocus=""true"" onclick=""UploadFile('"&ChannelID&"','"&ChannelModuleType&"','1','0','"&ClassID&"','1','0','0','ClassPic','','','','','" & InstallDir & UploadSetting(1) & "','" & UploadSetting(1) & "','" & InstallDir & "','" & InstallDir & UploadSetting(1) & "/" & ChannelDir & "','/" & ChannelDir & "');"">上传</button>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item layui-form-text"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">栏目META关键词：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-block"">" & vbCrlf
	Response.Write "            <textarea name='MetaKeyWord' id='MetaKeyWord' cols='60' rows='5' class=""layui-textarea"">" & MetaKeyWord & "</textarea>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item layui-form-text"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">栏目META网页描述：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-block"">" & vbCrlf
	Response.Write "            <textarea name='MetaDescript' id='MetaDescript' cols='60' rows='5' class=""layui-textarea"">" & MetaDescript & "</textarea>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <div class=""layui-inline"">" & vbCrlf
	Response.Write "            <label class=""layui-form-label"">截断字数：</label>" & vbCrlf
	Response.Write "            <div class=""layui-input-inline"">" & vbCrlf
	Response.Write "                <input type='number' min=""0"" id='CuteNums' name='CuteNums' value='" & CuteNums & "' size='5' maxlength='20' class=""layui-input"">" & vbCrlf
	Response.Write "            </div>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <div class=""layui-inline"">" & vbCrlf
	Response.Write "            <label class=""layui-form-label"">每行几个：</label>" & vbCrlf
	Response.Write "            <div class=""layui-input-inline"">" & vbCrlf
	Response.Write "                <input type='number' min=""1"" id='Columns' name='Columns' value='" & Columns & "' size='5' maxlength='20' class=""layui-input"">" & vbCrlf
	Response.Write "            </div>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <div class=""layui-inline"">" & vbCrlf
	Response.Write "            <label class=""layui-form-label"">分页：</label>" & vbCrlf
	Response.Write "            <div class=""layui-input-inline"">" & vbCrlf
	Response.Write "                <input type='number' min=""0"" id='PageNum' name='PageNum' value='" & PageNum & "' size='5' maxlength='20' class=""layui-input"">" & vbCrlf
	Response.Write "            </div>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "<fieldset class=""layui-elem-field"">" & vbCrlf
	Response.Write "<legend>图片属性：</legend>" & vbCrlf
	Response.Write "<div class=""layui-field-box"">" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <div class=""layui-inline"">" & vbCrlf
	Response.Write "            <label class=""layui-form-label"">图片宽度：</label>" & vbCrlf
	Response.Write "            <div class=""layui-input-inline"">" & vbCrlf
	Response.Write "                <input type='number' min=""0"" id='ImageWidth' name='ImageWidth' value='" & ImageWidth & "' size='5' maxlength='20' class=""layui-input"">" & vbCrlf
	Response.Write "            </div>" & vbCrlf
	Response.Write "            <div class=""layui-form-mid layui-word-aux"">px</div>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "        <div class=""layui-inline"">" & vbCrlf
	Response.Write "            <label class=""layui-form-label"">图片高度：</label>" & vbCrlf
	Response.Write "            <div class=""layui-input-inline"">" & vbCrlf
	Response.Write "                <input type='number' min=""0"" id='ImageHeight' name='ImageHeight' value='" & ImageHeight & "' size='5' maxlength='20' class=""layui-input"">" & vbCrlf
	Response.Write "            </div>" & vbCrlf
	Response.Write "            <div class=""layui-form-mid layui-word-aux"">px</div>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "</div>" & vbCrlf
	Response.Write "</fieldset>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">栏目模板：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-inline"">" & vbCrlf
	Response.Write "            <input type='text' id='Moban' name='Moban' value='" & rs("Moban") & "' size='40' maxlength='255' class='layui-input' readonly=""readonly"">" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "        <div class=""layui-input-block"">" & vbCrlf
	Response.Write "            <button type=""button"" class=""layui-btn"" hidefocus=""true"" onclick=""SelectMoban('" & ChannelID & "','Moban');"">选择模板</button><button type=""button"" class=""layui-btn layui-btn-danger"" hidefocus=""true"" onclick=""ClearColor('Moban');"">清空</button>&nbsp;&nbsp;可以为空" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">栏目风格：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-inline"">" & vbCrlf
	Response.Write "            <input type='text' id='SkinID' name='SkinID' value='" & rs("SkinID") & "' size='40' maxlength='255' class='layui-input' readonly=""readonly"">" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "        <div class=""layui-input-block"">" & vbCrlf
	Response.Write "            <button type=""button"" class=""layui-btn"" hidefocus=""true"" onclick=""SelectCss('SkinID');"">选择风格</button><button type=""button"" class=""layui-btn layui-btn-danger"" hidefocus=""true"" onclick=""ClearColor('SkinID');"">清空</button>&nbsp;&nbsp;可以为空" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	'Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	'Response.Write "        <label class=""layui-form-label"">页面框架：</label>" & vbCrlf
	'Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	'Response.Write "            " & Admin_ShowTemplate_Option(rs("TemplateID"),"TemplateID",2,ChannelID) & "" & vbCrlf
	'Response.Write "        </div>" & vbCrlf
	'Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label""><font color='#FF0000'>内容模板：</font></label>" & vbCrlf
	Response.Write "        <div class=""layui-input-inline"">" & vbCrlf
	Response.Write "            <input type='text' id='ContentMoban' name='ContentMoban' value='" & rs("ContentMoban") & "' size='40' maxlength='255' class='layui-input' readonly=""readonly"">" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "        <div class=""layui-input-block"">" & vbCrlf
	Response.Write "            <button type=""button"" class=""layui-btn"" hidefocus=""true"" onclick=""SelectMoban('" & ChannelID & "','ContentMoban');"">选择模板</button><button type=""button"" class=""layui-btn layui-btn-danger"" hidefocus=""true"" onclick=""ClearColor('ContentMoban');"">清空</button>&nbsp;&nbsp;可以为空" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label""><font color='#FF0000'>内容风格：</font></label>" & vbCrlf
	Response.Write "        <div class=""layui-input-inline"">" & vbCrlf
	Response.Write "            <input type='text' id='ContentSkinID' name='ContentSkinID' value='" & rs("ContentSkinID") & "' size='40' maxlength='255' class='layui-input' readonly=""readonly"">" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "        <div class=""layui-input-block"">" & vbCrlf
	Response.Write "            <button type=""button"" class=""layui-btn"" hidefocus=""true"" onclick=""SelectCss('ContentSkinID');"">选择风格</button><button type=""button"" class=""layui-btn layui-btn-danger"" hidefocus=""true"" onclick=""ClearColor('ContentSkinID');"">清空</button>&nbsp;&nbsp;可以为空" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	'Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	'Response.Write "        <label class=""layui-form-label""><font color='#FF0000'>内容框架：</font></label>" & vbCrlf
	'Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	'Response.Write "            " & Admin_ShowTemplate_Option(rs("ContentTemplateID"),"ContentTemplateID",3,ChannelID) & "" & vbCrlf
	'Response.Write "        </div>" & vbCrlf
	'Response.Write "    </div>" & vbCrlf
	Response.Write "</div>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<br>" & vbCrlf
	Response.Write "<input name=""ChannelID"" type=""hidden"" id=""ChannelID"" value=""" & ChannelID & """>" & Submit_Layui("提交修改","重新填写","确认要清空对话框内容？","javascript:history.back();","返回上一页","") & vbCrlf
	Response.Write "</form>" & vbCrlf
	Response.Write "<script>" & vbCrlf
	Response.Write "layui.use(['form'], function () {" & vbCrlf
	Response.Write "    var form = layui.form;" & vbCrlf
	Response.Write "    //自定义表单验证" & vbCrlf
	Response.Write "    form.verify({" & vbCrlf
	Response.Write "        ClassName: function (value, item) {" & vbCrlf
	Response.Write "            if (!value){" & vbCrlf
	Response.Write "                item.focus();" & vbCrlf
	Response.Write "                return ""栏目名称不能为空！"";" & vbCrlf
	Response.Write "            }" & vbCrlf
	Response.Write "        }," & vbCrlf
	Response.Write "        ClassID: function (value, item) {" & vbCrlf
	Response.Write "            if (!value){" & vbCrlf
	Response.Write "                item.focus();" & vbCrlf
	Response.Write "                return ""请选择" & ChannelTit & "栏目！"";" & vbCrlf
	Response.Write "            }" & vbCrlf
	Response.Write "        }," & vbCrlf
	Response.Write "    })" & vbCrLf
	Response.Write "    var ClassID = xmSelect.render({" & vbCrLf
	Response.Write "        el: '#ClassID'," & vbCrLf
	Response.Write "        name: 'ClassID'," & vbCrLf
	Response.Write "        layVerify: 'ClassID'," & vbCrLf
	Response.Write "        radio: true," & vbCrLf
	Response.Write "        clickClose: true," & vbCrLf
	'Response.Write "        tips: '指定栏目的" & ChannelTit & "?'," & vbCrLf
	'Response.Write "        empty: '呀, 没有数据呢'," & vbCrLf
	Response.Write "        autoRow: true," & vbCrLf
	Response.Write "        filterable: true," & vbCrLf
	Response.Write "        height: '300px'," & vbCrLf
	Response.Write "        direction: 'down'," & vbCrLf
	Response.Write "        tree: {" & vbCrLf
	Response.Write "            show: true,//是否显示树状结构" & vbCrLf
	Response.Write "            showFolderIcon: true,//是否展示三角图标" & vbCrLf
	Response.Write "            showLine: true,//是否显示虚线" & vbCrLf
	Response.Write "            indent: 20,//间距" & vbCrLf
	Response.Write "            expandedKeys: true,//默认展开节点的数组, 为 true 时, 展开所有节点" & vbCrLf
	Response.Write "            strict: false,//是否严格遵守父子模式" & vbCrLf
	Response.Write "        }," & vbCrLf
	Response.Write "        toolbar: {" & vbCrLf
	Response.Write "            show: false," & vbCrLf
	Response.Write "            list: ['ALL', 'REVERSE', 'CLEAR']" & vbCrLf
	Response.Write "        }," & vbCrLf
	Response.Write "        data: [" & vbCrLf
	Response.Write "            {name: '作为一级栏目', value: 0"
	If Int(ClassID)=Int(0) Then Response.Write ", selected: true"
	Response.Write "}," & vbCrLf
	Response.Write GetClass_Option(ChannelID, 0, ClassID)
	Response.Write "        ]" & vbCrLf
	Response.Write "    })" & vbCrLf
	Response.Write "    //提交监听" & vbCrlf
	Response.Write "    form.on('submit(submit)', function (data) {" & vbCrlf
	Response.Write "        loading = layer.load(1, {shade: [0.1,'#fff']});" & vbCrlf
	Response.Write "        $.ajax({" & vbCrLf
	Response.Write "            type: 'post'," & vbCrLf
	Response.Write "            url: '?Action=SaveModify'," & vbCrLf
	Response.Write "            data: data.field," & vbCrLf
	Response.Write "            dataType: 'json'," & vbCrLf
	Response.Write "            success: function(res) {" & vbCrLf
	Response.Write "                layer.close(loading);" & vbCrlf
	Response.Write "                if(res.code > 0){" & vbCrlf
	If ChannelIsCreateHtml = True Then
		Response.Write "                    var diag = new Dialog({" & vbCrlf
		Response.Write "                        id:'CreateClass'," & vbCrlf
		Response.Write "                        title:'正在生成相关数据'," & vbCrlf
		Response.Write "                        url:'" & InstallDir & AdminFolder & "/" & ChannelDir & "/Admin_Create" & ChannelDir & ".asp?Action=ListCont&ClassList=1&ChannelID='+res.ChannelID+'&Csid='+res.ClassID+''," & vbCrlf
		Response.Write "                        width:450," & vbCrlf
		Response.Write "                        height:200," & vbCrlf
		Response.Write "                        modal:true" & vbCrlf
		Response.Write "                    });" & vbCrlf
		Response.Write "                    diag.autoClose=1;" & vbCrlf
		Response.Write "                    diag.show();" & vbCrlf
		Response.Write "                    setTimeout(function(){" & vbCrlf
		Response.Write "                        layer.msg(res.msg,{icon: 1, time: 1000},function(){" & vbCrlf
		Response.Write "                            location.href = res.url;" & vbCrlf
		Response.Write "                        });" & vbCrlf
		Response.Write "                    },1500);" & vbCrlf
	Else
		Response.Write "                    layer.msg(res.msg,{icon: 1, time: 1000},function(){" & vbCrlf
		Response.Write "                        location.href = res.url;" & vbCrlf
		Response.Write "                    });" & vbCrlf
	End If
	Response.Write "                }else{" & vbCrlf
	Response.Write "                    layer.msg(res.msg,{icon: 2, time: 1000});" & vbCrlf
	Response.Write "                }" & vbCrlf
	Response.Write "            }" & vbCrLf
	Response.Write "        });" & vbCrLf
	Response.Write "    });" & vbCrlf
	Response.Write "});" & vbCrlf
	Response.Write "</script>" & vbCrlf
	Rs.Close
	Response.Write "</body>" & vbCrLf & "</html>"
End Sub

Sub SaveModify()
	If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
		Dim rs3
		Dim funder,ftrue,fir_true,fDepth,ImageWidth,ImageHeight,CuteNums,Columns,PageNum
		Dim ClassName,ClassDir,ClassPic,ClassParent,ClassParentStr,ClassOrder,ClassParentStr2,fDepth2,ClassOrder2,ClassOrders,Moban,SkinID,TemplateID,ContentMoban,ContentSkinID,ContentTemplateID
		Dim forumtype,forumpro,forumhidden,fhidden,rs2,cFir,ccid2,classid2,fhn,HtmlFileDir,CHtmlFileDir,MetaKeyWord,MetaDescript,QHtmlFileDir,QHtmlFileDir2
		fhidden=False
		funder=False
		ftrue=False
		fir_true=false
		ChannelID=Trim(Request.Form("ChannelID"))
		ClassID=Trim(Request.Form("ClassID"))
		Sql="Select Count(ClassID) From "&Data_Name&" Where ChannelID="&ChannelID&" And ClassParent="&ClassID
		Call Exec(Rs,Sql,2)
		If Int(Rs(0))>0 Then funder=True
		Rs.Close
		Sql="Select Top 1 * From "&Data_Name&" Where ChannelID="&ChannelID&" And ClassID="&ClassID
		Call Exe_Conn(Rs,Sql,3)
		If Rs.Eof Then
			Rs.Close
			Response.Write "{""code"":0,""msg"":""\u680f\u76eeID\uff08"&ClassID&"\uff09\u4e0d\u5b58\u5728\uff01""}" & vbCrLf
			Response.End()
		End If
		ClassName=Rs("ClassName")
		ImageWidth=Rs("ImageWidth")
		ImageHeight=Rs("ImageHeight")
		CuteNums=Rs("CuteNums")
		Columns=Rs("Columns")
		PageNum=Rs("PageNum")
		CHtmlFileDir=rs("ClassDir")
		QHtmlFileDir=Trim(rs("HtmlFileDir"))
		ClassPic=rs("ClassPic")
		MetaKeyWord=rs("MetaKeyWord")
		MetaDescript=rs("MetaDescript")
		If QHtmlFileDir<>"" And CHtmlFileDir<>"" Then QHtmlFileDir2=Left(QHtmlFileDir,(len(QHtmlFileDir)-len(CHtmlFileDir)-1))
		If Rs("ClassDepth")=0 And Cstr(Rs("ClassDepth"))="0" Then fir_true=True '一级栏目
		AClassID=rs("AClassID")
		ClassParent=rs("ClassParent")
		ClassParentStr=rs("ClassParentStr")
		ClassOrders=rs("ClassOrder")
		ccid2=Code_Int("ClassID",ClassID) '新的父类
		ClassName=Code_Admin("ClassName",1,20)
		ClassDir=Code_Admin("ClassDir",1,0)
		ClassPic=Code_Form("ClassPic")
		MetaKeyWord=Code_Form("MetaKeyWord")
		MetaDescript=Code_Form("MetaDescript")
		Moban=Code_Form("Moban")
		SkinID=Code_Form("SkinID")
		TemplateID=Code_Form("TemplateID")
		If TemplateID = "" Then TemplateID = 0
		ContentMoban=Code_Form("ContentMoban")
		ContentSkinID=Code_Form("ContentSkinID")
		ContentTemplateID=Code_Form("ContentTemplateID")
		If ContentTemplateID = "" Then ContentTemplateID = 0
		ImageWidth=Code_Form("ImageWidth")
		ImageHeight=Code_Form("ImageHeight")
		CuteNums=Code_Form("CuteNums")
		Columns=Code_Form("Columns")
		PageNum=Code_Form("PageNum")
		If ClassName="" Then
			Rs.Close
			Response.Write "{""code"":0,""msg"":""\u680f\u76ee\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a\uff01""}" & vbCrLf
			Response.End()
		End If
		HtmlFileDir = Replace(Replace(Replace(trim(ClassDir), "\","/"), " ",""), "'","")
		If HtmlFileDir="" Then HtmlFileDir = Get_PinYin(ClassName)
		If Not IsValidChar(HtmlFileDir) Then
			Rs.Close
			Response.Write "{""code"":0,""msg"":""\u680f\u76eeu76ee\u5f55\u4e3a\u7a7a\u6216\u8005\u542b\u6709\u975e\u82f1\u6587\u5b57\u7b26\uff01""}" & vbCrLf
			Response.End()
		End If
		If Right(HtmlFileDir, 1) <> "/" Then
			HtmlFileDir = HtmlFileDir
		Else
			HtmlFileDir = Left(HtmlFileDir,Len(HtmlFileDir)-1)
		End If
		If Left(HtmlFileDir, 1) = "/" Then
			Rs.Close
			Response.Write "{""code"":0,""msg"":""\u76ee\u5f55\u524d\u9762\u4e0d\u80fd\u6709\u201c\/\u201d\uff0c\u8bf7\u8ba4\u771f\u586b\u5199\u680f\u76eeu76ee\u5f55\uff01""}" & vbCrLf
			Response.End()
		End If
		If ImageWidth="" or IsNumeric(ImageWidth)=False Then ImageWidth = 180
		If ImageHeight="" or IsNumeric(ImageHeight)=False Then ImageHeight = 120
		If CuteNums="" or IsNumeric(CuteNums)=False Then CuteNums = 0
		If Columns="" or IsNumeric(Columns)=False Then Columns = 1
		If PageNum="" or IsNumeric(PageNum)=False Then PageNum = 0
		If FoundErr=True Then
			Exit Sub
		End If
		'-----------判断是否修改栏目级别
		If Int(ccid2)<>Int(ClassID) And Int(ccid2)<>Int(ClassParent) And funder=False Then
			ftrue=True
			If ccid2>0 Then
			Sql="Select Top 1 AClassID,ClassDepth,ClassParentStr,ClassOrder,HtmlFileDir From "&Data_Name&" Where ChannelID="&ChannelID&" And ClassID="&ccid2
			Call Exec(Rs2,Sql,2)
			If Rs2.Eof Then
				Rs2.Close
				Set Rs2=Nothing
				Rs.Close
				Response.Write "{""code"":0,""msg"":""\u8981\u66f4\u6539\u6240\u5c5e\u7684\u7236\u7ea7\u680f\u76eeID\uff08"&ccid2&"\uff09\u4e0d\u5b58\u5728\uff01""}" & vbCrLf
				Response.End()
				Exit Sub
			End If
			'获取新的父类信息
			classid2=Rs2("AClassID")
			fDepth2=rs2("ClassDepth")
			ClassParentStr2=rs2("ClassParentStr")
			ClassOrder2=rs2("ClassOrder")
			QHtmlFileDir2=rs2("HtmlFileDir")
			Rs2.Close
			ClassOrder=0
			Sql="Select Max(ClassOrder) From "&Data_Name&" Where ChannelID="&ChannelID&" And AClassID="&classid2&" And ClassID In("&ClassParentStr2&")"
			Call Exec(Rs2,Sql,2)
			If Not Rs2.Eof Then ClassOrder=Rs2(0)
			Rs2.Close
			Set Rs2=Nothing
			'更新栏目的排序
			Rs("ClassOrder")=ClassOrder
			Rs("ClassDepth")=fDepth2+1
			Rs("AClassID")=classid2
			Rs("ClassParent")=ccid2
			Rs("ClassChild")=0
			Rs("ClassParentStr")=ClassParentStr2&","&ClassID
			Rs("ClassChildStr")=ClassID
			End If
		End If
		'--------判断结束
		Rs("ClassName")=ClassName
		Rs("ClassDir")=HtmlFileDir
		HtmlFileDir = QHtmlFileDir2 & HtmlFileDir & "/"
		Rs("HtmlFileDir")=HtmlFileDir
		Rs("ClassPic")=ClassPic
		Rs("MetaKeyWord")=MetaKeyWord
		Rs("MetaDescript")=MetaDescript
		Rs("Moban")=Moban
		Rs("SkinID")=SkinID
		Rs("TemplateID")=TemplateID
		Rs("ContentMoban")=ContentMoban
		Rs("ContentSkinID")=ContentSkinID
		Rs("ContentTemplateID")=ContentTemplateID
		Rs("ImageWidth")=ImageWidth
		Rs("ImageHeight")=ImageHeight
		Rs("CuteNums")=CuteNums
		Rs("Columns")=Columns
		Rs("PageNum")=PageNum
		'一级栏目
		If ccid2=0 Then
		Sql="Select Max(AClassID) From "&Data_Name&" Where ChannelID="&ChannelID
			Call Exec(Rs3,Sql,2)
			If Not Rs3.Eof Then Classid2=Rs3(0)
			Rs3.Close
			Rs("ClassOrder")=0
			Rs("ClassDepth")=0
			Rs("AClassID")=Classid2+1
			Rs("ClassParent")=0
			Rs("ClassChild")=0
			Rs("ClassParentStr")=ClassID
			Rs("ClassChildStr")=ClassID
			ClassOrder=0
		End if
		Rs.Update
		Rs.Close
		If fTrue=True Then
			If ccid2>0 Then
			'更新子类数量(当前)
			Call Exec("","Update "&Data_Name&" Set ClassChild=ClassChild+1 Where ChannelID="&ChannelID&" And AClassID="&classid2&" And ClassID In("&ClassParentStr2&")",0)
		End if
		'更新子类数量（原来）
		Call Exec("","Update "&Data_Name&" Set ClassChild=ClassChild-1 Where ChannelID="&ChannelID&" And AClassID="&AClassID&" And ClassID In("&ClassParentStr&")",0)
		'更新子栏目
		dim ccids,ccidss,cSql,cRs
		Sql = "Select ClassID,ClassChildStr From "&Data_Name&" Where (AClassID="&AClassID&" or AClassID="&classid2&") And ChannelID="&ChannelID
		Call Exe_Conn(Rs,Sql,3)
		Do While Not Rs.Eof
			ccids=Rs("ClassID")
			ccidss=""
			cSql = "Select ClassID From "&Data_Name&" Where ChannelID="&ChannelID&" and classparentstr like '%"&ccids&"%' Order By ClassID"
			Call Exec(cRs,cSql,2)
			Do While Not cRs.Eof
				if ccidss="" Then
					ccidss=cRs("ClassID")
				else
					ccidss=ccidss&","&cRs("ClassID")
				end if
				cRs.MoveNext
			Loop
			cRs.Close
			Rs("ClassChildStr")=ccidss
			Rs.Update		
			Rs.MoveNext
		Loop
		Rs.Close
		'更新原栏目的排序
		Call Exec("","Update "&Data_Name&" Set ClassOrder=ClassOrder-1 Where ChannelID="&ChannelID&" And AClassID="&AClassID&" And ClassOrder>"&ClassOrders,0)
		End If
		'转移目录
		If ChannelIsCreateHtml = True Then
			If lcase(QHtmlFileDir) <> lcase(HtmlFileDir) Then
				Dim Cfs
				Set Cfs=New Cls_FileSystem
					Cfs.Move_Folder InstallDir & ChannelDir&"/"&QHtmlFileDir,InstallDir & ChannelDir&"/"&HtmlFileDir
				Set Cfs=Nothing
			End If
		End If
		'If ChannelIsCreateHtml = True Then Response.Write "<iframe id='CreateClass' width='100%' height='210' frameborder='0' src='Admin_CreateClass.asp?Action=ListCont&ChannelID=" & ChannelID & "&ClassID=" & ClassID & "'></iframe>"
		'Response.Write IsConfirm("成功编辑栏目（"&ClassName&"）！请点击确定，需要继续修改点击取消！",AdminFolder & "/Admin/" & strFileName & "?ChannelID="&ChannelID&"",AdminFolder & "/Admin/" & strFileName & "?Action=Edit&ChannelID="&ChannelID&"&ClassID="&ClassID&"")
		Response.Write "{""code"":1,""msg"":""\u6210\u529f\u7f16\u8f91\u680f\u76ee\uff08"&ClassName&"\uff09\uff01"",""ChannelID"":"&ChannelID&",""ClassID"":"&ClassID&",""url"":""?ChannelID="&ChannelID&"""}" & vbCrLf
		Response.End()
		Exit Sub
	End If
End Sub

Sub Class_Del()
	If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
		ChannelID = Code_CLng(Trim(Code_Form("ChannelID")))
		ClassID = Code_CLng(Trim(Code_Form("ClassID")))
		If ClassID = "" Then
			Response.Write "{""msg"":""\u8981\u5220\u9664\u7684\u680f\u76eeID\uff08"&ClassID&"\uff09\u4e0d\u5b58\u5728\uff01"",""code"":0}"
			Response.End()
		End If
		If ChannelDataName = "" Then
			Response.Write "{""msg"":""\u65e0\u6cd5\u786e\u5b9a\u9891\u9053\u6240\u5728\u6570\u636e\u5e93\u4f4d\u7f6e\uff01"",""code"":0}"
			Response.End()
		End If
		If ChannelIsCreateHtml=True Then
			Sql = "Select * From "&Data_Name&" Where ClassID="&ClassID
			Call Exec(Rs,Sql,2)
			Set Cfs=New Cls_FileSystem
			Cfs.Del_Folder InstallDir & ChannelDir & "/" & Rs("ClassDir")
			Cfs.Del_Folder InstallDir & ChannelDir & "/" & Rs("HtmlFileDir")
			Set Cfs=Nothing
			Rs.Close
		End If
		Sql = "Select Top 1 ClassParentStr From "&Data_Name&" Where ChannelID="&ChannelID&" And ClassID="&ClassID
		Call Exec(Rs,Sql,2)
		If Rs.Eof Then
			Rs.Close
			Response.Write "{""msg"":""\u8981\u5220\u9664\u7684\u680f\u76eeID\uff08"&ClassID&"\uff09\u4e0d\u5b58\u5728\uff01"",""code"":0}"
			Response.End()
		End If
		ClassParentStr=Rs("ClassParentStr")
		Rs.Close
		Sql = "Select Count(ClassID) From "&Data_Name&" Where ChannelID="&ChannelID&" And ClassParent="&ClassID
		Call Exec(Rs,Sql,2)
		If Rs(0)>0 Then
			Rs.Close
			Response.Write "{""msg"":""\u8bf7\u5148\u5220\u9664\u5176\u5b50\u680f\u76ee\uff01"",""code"":0}"
			Response.End()
		End If
		Rs.Close
		sqlDel = "select UploadFiles From "&ChannelDataName&" where ChannelID="&ChannelID&" And ClassID="&Clng(ClassID)
		Call Exec(rsDel,sqlDel,2)
		Do While Not rsDel.EOF
			If rsDel("UploadFiles")<>"" Then
				StrDownloadUrl=Trim(Replace(rsDel("UploadFiles"),"{$download_dir}",InstallDir&UploadSetting(1)))
				If Instr(StrDownloadUrl,"@@@") >0 Then
					StrDownloadUrl=Split(StrDownloadUrl,"@@@")
					For j=0 to Ubound(StrDownloadUrl)
						Set Cfs=New Cls_FileSystem
						Cfs.Del_File(StrDownloadUrl(i))
						Set Cfs=Nothing
					Next
				Else
					Set Cfs=New Cls_FileSystem
					Cfs.Del_File(StrDownloadUrl)
					Set Cfs=Nothing
				End If
			End If
			rsDel.MoveNext
		Loop
		rsDel.Close
		Set rsDel = Nothing
		Call Exec("","Delete From "&ChannelDataName&" Where ChannelID="&ChannelID&" And ClassID="&Clng(ClassID)&"",0)
		Sql = "Delete From "&Data_Name&" Where ChannelID="&ChannelID&" And ClassID="&ClassID
		Call Exec("",Sql,0)
		If Is_Null(ClassParentStr)<>"" Then
			Sql = "Update "&Data_Name&" Set ClassChild=ClassChild-1 Where ChannelID="&ChannelID&" And ClassID In("&ClassParentStr&")"
			Call Exec("",Sql,0)
		End If
		Response.Write "{""msg"":""\u6210\u529f\u5220\u9664\u680f\u76eeID\uff08"&ClassID&"\uff09\uff01"",""ChannelID"":"&ChannelID&",""url"":""?ChannelID="&ChannelID&""",""code"":1}"
		Response.End()
	End If
End Sub

Sub Class_DelHtml()
	If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
		ChannelID = Code_CLng(Trim(Code_Form("ChannelID")))
		ClassID = Code_CLng(Trim(Code_Form("ClassID")))
		Set Cfs=New Cls_FileSystem
		SqlClass = "Select * From "&Data_Name&" Where ClassID="&ClassID
		Call Exec(RsClass,SqlClass,2)
		While not RsClass.eof
			intPageSize=CLng(ChannelListNum(1))
			intRecordCount = Exec("","Select Count(*) From [" & ChannelDataName & "] Where ChannelID=" & ChannelID & " And Hidden=" & WK_True & " And IsDelete=" & WK_False & " And ClassID=" & rsClass("ClassID"),1)(0)
			if intRecordCount=0 Then
				intRecordCount=1
			end if
			If intPageSize <= 0 Then intPageSize = 20
			intPageCount = intRecordCount / intPageSize
			if ( intRecordCount mod intPageSize <> 0) Then
				intPageCount = intPageCount + 1
			end if
			For i = 1 To intPageCount
				if i=1 Then
					Cfs.Del_File InstallDir & ChannelDir & "/" & RsClass("HtmlFileDir") & "Index" & ChannelHtmlExtName
				else
					Cfs.Del_File InstallDir & ChannelDir & "/" & RsClass("HtmlFileDir") & "Index_" & i & ChannelHtmlExtName
				end if
			Next
		rsClass.movenext
		Wend
		Set Cfs=Nothing
		rsClass.Close:Set rsClass = Nothing
		Response.Write "{""msg"":""\u6210\u529f\u5220\u9664\u680f\u76eeID\uff08"&ClassID&"\uff09\u7684\u9996\u9875Html\u6587\u4ef6\uff01"",""url"":""?ChannelID="&ChannelID&""",""code"":1}"
		Response.End()
	End If
End Sub

Sub ListOrder()
	If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
		ChannelID = Code_CLng(Trim(Code_Form("ChannelID")))
		ClassID = Code_CLng(Trim(Code_Form("ClassID")))
		ClassOrder = Code_CLng(Trim(Code_Form("ClassOrder")))
		Call Exec("","Update ["&Data_Name&"] Set ClassOrder="&ClassOrder&" Where ClassID="&ClassID,0)
		Response.Write "{""msg"":""\u6392\u5e8f\u6210\u529f\uff01"",""url"":""?ChannelID="&ChannelID&""",""code"":1}"
		Response.End()
	End If
End Sub

Sub Class_Order()
	Response.Write "<!DOCTYPE html>" & vbCrLf
	Response.Write "<head>" & vbCrLf
	Response.Write "<title>栏目列表</title>" & vbCrlf
	Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" & vbCrLf
	Response.Write "<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-status-bar-style' content='black'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-capable' content='yes'>" & vbCrLf
	Response.Write "<meta name='format-detection' content='telephone=no'>" & vbCrLf
	Response.Write "<link rel=""stylesheet"" type=""text/css"" href=""../fonts/font-awesome/css/font-awesome.min.css"" />" & vbCrLf
	Response.Write "<link href='../Plugins/layui/css/layui.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link href='../Style/global.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link href='../Style/font.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<script type='text/javascript'>" & vbCrLf
	Response.Write "var pc_file = '" & InstallDir & "';" & vbCrLf
	Response.Write "var admin_file = '" & AdminFolder & "/';" & vbCrLf
	Response.Write "</script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../Js/Admin.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/main.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcore.min.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcalendar.min.js'></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/layui/layui.js""></script>" & vbCrLf
	Response.Write "</head>" & vbCrlf
	Response.Write "<body>" & vbCrlf
	Response.Write "<form class='layui-form layui-form-pane' name=""myform"" action=""?Action=SaveOrder&ChannelID=" & ChannelID & """ method=""post"">" & vbCrlf
	Response.Write "<input name=""ChannelID"" type=""hidden"" id=""ChannelID"" value=""" & ChannelID & """>" & vbCrlf
	Response.Write "<div class=""admin-main fadeInUp animated"">" & vbCrlf
	Response.Write "    <fieldset class=""layui-elem-field layui-field-title"">" & vbCrlf
	Response.Write "        <legend>重新计数排序</legend>" & vbCrlf
	Response.Write "    </fieldset>" & vbCrlf
	Response.Write "    <fieldset class=""layui-elem-field"">" & vbCrlf
	Response.Write "        <legend>注意：</legend>" & vbCrlf
	Response.Write "        <div class=""layui-field-box"">" & vbCrlf
	Response.Write "            现在正在执行重新计算所有栏目计数、所属下级栏目、栏目排序等操作；<br>根据您的服务器情况可能会执行一到两秒钟左右的时间，请在些期间不要关闭本页！" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </fieldset>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <div class=""layui-input-block"">" & vbCrlf
	Response.Write "            <button type=""button"" class=""layui-btn"" lay-submit="""" lay-filter=""submit"">执行重新排序操作</button>" & vbCrlf
	Response.Write "            <a href=""?ChannelID="&ChannelID&""" class=""layui-btn layui-btn-danger"">返回</a>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "</div>" & vbCrlf
	Response.Write "</form>" & vbCrlf
	Response.Write "<script>" & vbCrlf
	Response.Write "layui.use(['form'], function () {" & vbCrlf
	Response.Write "    var form = layui.form;" & vbCrlf
	Response.Write "    //提交监听" & vbCrlf
	Response.Write "    form.on('submit(submit)', function (data) {" & vbCrlf
	Response.Write "        loading = layer.load(1, {shade: [0.1,'#fff']});" & vbCrlf
	Response.Write "        $.ajax({" & vbCrLf
	Response.Write "            type: 'post'," & vbCrLf
	Response.Write "            url: '?Action=SaveOrder'," & vbCrLf
	Response.Write "            data: data.field," & vbCrLf
	Response.Write "            dataType: 'json'," & vbCrLf
	Response.Write "            success: function(res) {" & vbCrLf
	Response.Write "                layer.close(loading);" & vbCrlf
	Response.Write "                if(res.code > 0){" & vbCrlf
	Response.Write "                    layer.msg(res.msg,{icon: 1, time: 1000},function(){" & vbCrlf
	Response.Write "                        location.href = res.url;" & vbCrlf
	Response.Write "                    });" & vbCrlf
	Response.Write "                }else{" & vbCrlf
	Response.Write "                    layer.msg(res.msg,{icon: 2, time: 1000});" & vbCrlf
	Response.Write "                }" & vbCrlf
	Response.Write "            }" & vbCrLf
	Response.Write "        });" & vbCrLf
	Response.Write "    });" & vbCrlf
	Response.Write "});" & vbCrlf
	Response.Write "</script>" & vbCrlf
	Response.Write "</body>" & vbCrLf & "</html>"
End Sub

Sub Class_SaveOrder()
	If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
		Dim ClassDepth,ccpa,ccch,cSql,cRs,ci,ccids,ccidss
		ChannelID = Code_CLng(Trim(Code_Form("ChannelID")))
		Sql = "Select Top 1 ClassDepth From "&Data_Name&" Where ChannelID="&ChannelID&" Order By ClassDepth"
		Call Exec(Rs,Sql,2)
		If Rs.Eof Then
			Rs.Close
			Response.Write "{""code"":0,""msg"":""\u6682\u65f6\u8fd8\u6ca1\u6709\u680f\u76ee\uff01""}" & vbCrLf
			Response.End()
			Exit Sub
		End If
		ClassDepth=Rs(0)
		Rs.Close
		If Not IsNumeric(ClassDepth) Then ClassDepth=0
		If Int(ClassDepth)>0 Then
			Response.Write "{""code"":0,""msg"":""\u680f\u76ee\u51fa\u73b0\u4e25\u91cd\u9519\u8bef\uff01\u8bf7\u4e0e\u5f00\u53d1\u4eba\u5458\u8054\u7cfb\u3002""}" & vbCrLf
			Response.End()
			Exit Sub
		End If
		AClassID=1
		Sql = "Select ClassID,AClassID From "&Data_Name&" Where ClassDepth="&ClassDepth&" And ChannelID="&ChannelID&" Order By AClassID,ClassID"
		Call Exec(Rs,Sql,2)
		Do While Not Rs.Eof
			ClassID=Rs("ClassID")
			Call Exec("","update "&Data_Name&" set AClassID="&AClassID&",ClassParent=0,ClassChild=0,ClassOrder=0,ClassDepth=0,ClassParentStr='"&ClassID&"' where ClassID="&ClassID,0)
			Call Class_Order_Setup(AClassID,ClassID,1,ClassID,1,1)	
		Rs.MoveNext
		AClassID=AClassID+1
		Loop
		Rs.Close
		
		Sql = "Select ClassID,ClassChildStr From "&Data_Name&" Where ChannelID="&ChannelID
		Call Exe_Conn(Rs,Sql,3)
		Do While Not Rs.Eof
			ccids=Rs("ClassID")
			ccidss=""
			cSql = "Select ClassID From "&Data_Name&" Where ChannelID="&ChannelID&" and Instr(','+ClassParentStr+',',',"&ccids&",')>0 Order By ClassID"
			Call Exec(cRs,cSql,2)
			Do While Not cRs.Eof
				if ccidss="" Then
					ccidss=cRs("ClassID")
				else
					ccidss=ccidss&","&cRs("ClassID")
				end if
				cRs.MoveNext
			Loop
			cRs.Close
			Rs("ClassChildStr")=ccidss
			Rs.Update		
			Rs.MoveNext
		Loop
		Rs.Close
		Response.Write "{""code"":1,""msg"":""\u6210\u529f\u5bf9\u6240\u6709\u680f\u76ee\u8fdb\u884c\u4e86\u91cd\u65b0\u8ba1\u6570\u6392\u5e8f\uff01"",""url"":""?ChannelID="&ChannelID&"""}" & vbCrLf
		Response.End()
	End If
End Sub

Sub Class_Order_Setup(cid,fID,oDepth,fParent,fOrder,fh)
	Dim oRs,oSQL
	Dim nfid,ffp,fhh,nf_id
	ffp=fparent&","
	If fparent="" Then
		ffp=""
	End If
	oSQL = "Select ClassID,ClassDepth From "&Data_Name&" Where ChannelID="&ChannelID&" And ClassParent="&fid&" Order By ClassOrder Asc,ClassID Asc"
	Call Exec(oRs,oSQL,2)
	Do While Not oRs.Eof
		fhh=fh
	nfid=oRs("ClassID")
		Call Exec("","Update "&Data_Name&" Set AClassID="&cid&",ClassParent="&fid&",ClassChild=0,ClassOrder="&forder&",ClassDepth="&oDepth&",ClassParentStr='"&ffp&nfid&"' Where ChannelID="&ChannelID&" And ClassID="&nfid,0)
		forder=forder+1
		Call Exec("","Update "&Data_Name&" Set ClassChild=ClassChild+1 Where ChannelID="&ChannelID&" And AClassID="&cid&" And ClassID In("&fparent&")",0)
		Call Class_Order_Setup(cid,nfid,oDepth+1,ffp&nfid,forder,fhh)
		oRs.MoveNext
	Loop
	oRs.Close
	Set oRs=Nothing
End Sub

Sub Class_Directory()
	Response.Write "<!DOCTYPE html>" & vbCrLf
	Response.Write "<head>" & vbCrLf
	Response.Write "<title>栏目列表</title>" & vbCrlf
	Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" & vbCrLf
	Response.Write "<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-status-bar-style' content='black'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-capable' content='yes'>" & vbCrLf
	Response.Write "<meta name='format-detection' content='telephone=no'>" & vbCrLf
	Response.Write "<link rel=""stylesheet"" type=""text/css"" href=""../fonts/font-awesome/css/font-awesome.min.css"" />" & vbCrLf
	Response.Write "<link href='../Style/global.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link href='../Style/font.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<script type='text/javascript'>" & vbCrLf
	Response.Write "var pc_file = '" & InstallDir & "';" & vbCrLf
	Response.Write "var admin_file = '" & AdminFolder & "/';" & vbCrLf
	Response.Write "</script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../Js/Admin.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/main.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcore.min.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcalendar.min.js'></script>" & vbCrLf
	Response.Write "</head>" & vbCrlf
	Response.Write "<body>" & vbCrlf
	Call Exec(rsClass,"select * from "&Data_Name&"",2)
	Do While Not rsClass.EOF
		If rsClass("ClassDepth")>0 Then
			ClassParentStr=Trim(rsClass("ClassParentStr"))
			If Instr(ClassParentStr,",") >0 Then
				ClassParentStr=Split(ClassParentStr,",")
				For i=0 to Ubound(ClassParentStr)
					Call Exec(rsList,"select * from "&Data_Name&" Where ClassID=" & ClassParentStr(i),2)
					If rsList.BOF And rsList.EOF Then
						ClassDir=""
						rsList.Close
						Set rsList = Nothing
					Else
						ClassDir=ClassDir&rsList("ClassDir") & "/"
						rsList.Close
						Set rsList = Nothing
					End If
				Next
				Call Exec("","Update "&Data_Name&" Set ClassDir='" & Get_PinYin(rsClass("ClassName")) & "',HtmlFileDir='" & ClassDir & "' Where ClassID=" & rsClass("ClassID"),0)
				ClassDir=""
			End If
		Else
			Call Exec("","Update "&Data_Name&" Set ClassDir='" & Get_PinYin(rsClass("ClassName")) & "',HtmlFileDir='" & Get_PinYin(rsClass("ClassName")) & "/' Where ClassID=" & rsClass("ClassID"),0)
		End If
		rsClass.MoveNext
	Loop
	rsClass.Close
	Set rsClass = Nothing
	Response.Write IsSuccess("成功整理目录！",AdminFolder & "/Admin/" & strFileName & "?ChannelID="&ChannelID&"")
	Response.Write "</body>" & vbCrLf & "</html>"
End Sub

Sub ToPinyin()
	If Trim(Request("ClassName"))<>"" Then Response.Write Get_PinYin(Trim(Request("ClassName")))
End Sub

Sub Class_Mod()
	Response.Write "<!DOCTYPE html>" & vbCrLf
	Response.Write "<head>" & vbCrLf
	Response.Write "<title>栏目列表</title>" & vbCrlf
	Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" & vbCrLf
	Response.Write "<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-status-bar-style' content='black'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-capable' content='yes'>" & vbCrLf
	Response.Write "<meta name='format-detection' content='telephone=no'>" & vbCrLf
	Response.Write "<link rel=""stylesheet"" type=""text/css"" href=""../fonts/font-awesome/css/font-awesome.min.css"" />" & vbCrLf
	Response.Write "<link href='../Plugins/layui/css/layui.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link href='../Style/global.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link href='../Style/font.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<script type='text/javascript'>" & vbCrLf
	Response.Write "var pc_file = '" & InstallDir & "';" & vbCrLf
	Response.Write "var admin_file = '" & AdminFolder & "/';" & vbCrLf
	Response.Write "</script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../Js/Admin.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/main.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcore.min.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcalendar.min.js'></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/layui/layui.js""></script>" & vbCrLf
	Response.Write "</head>" & vbCrlf
	Response.Write "<body>" & vbCrlf
	Dim ftrue,fname1,fname2
	If ChannelDataName = "" Then
		Response.Write IsSuccess("无法确定模型所在数据库位置！",AdminFolder & "/Admin/" & strFileName & "?ChannelID="&ChannelID&"")
		Exit Sub
	End If
	Response.Write "<form class='layui-form layui-form-pane' name=""myform"" action=""?Action=SaveMod&ChannelID=" & ChannelID & """ method=""post"">" & vbCrlf
	Response.Write "<input name=""ChannelID"" type=""hidden"" id=""ChannelID"" value=""" & ChannelID & """>" & vbCrlf
	Response.Write "<div class=""admin-main fadeInUp animated"">" & vbCrlf
	Response.Write "    <fieldset class=""layui-elem-field layui-field-title"">" & vbCrlf
	Response.Write "        <legend>合并" & ChannelName & "栏目数据</legend>" & vbCrlf
	Response.Write "    </fieldset>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">从栏目：</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	Response.Write "            <div id=""sel_1_outer"" ztype=""select"" class=""z-combox"" style=""display:inline-block; *zoom: 1;*display: inline;vertical-align:middle;height:auto;width:auto;position:relative;border:none 0;margin:0;padding:0;white-space: nowrap;"" _style=""width:100%;height:30px;""><input type=""text"" ztype=""select"" id=""sel_1"" name=""sel_1"" tabindex=""-1"" autocomplete=""off"" class=""inputText"" style=""width:100%;height:30px;position:absolute;z-index:-1;"" value="""" startvalue="""" lay-verify=""sel_1""/><input type=""text"" id=""sel_1_textField"" autocomplete=""off"" class=""inputText"" style=""vertical-align:middle; cursor:default;width:100%;height:30px;"" /><a id=""sel_1_spinner"" class=""z-combox-spinner"" style=""position:relative; left:-17px; margin-right:-15px; cursor:pointer; width:13px; height:15px;vertical-align:middle;""><b></b></a><div id=""sel_1_list"" class=""optgroup"" style=""text-align:left;display:none;""><div id=""sel_1_ul"" style=""left:-1px; width:-1px;""><script>Combox_sel_1_Init=function(){var _el=Zving.getDom('sel_1');if(_el._components){return true;}var  _data=[];var  _DataSource;" & Class_Mod_List() & "var combox_sel_1 = new Zving.Selector({el:_el,data:_data,DataSource:_DataSource});};if(Zving.Page.isReady){Combox_sel_1_Init();}else{Zving.Page.onReady(Combox_sel_1_Init);}</script></div></div></div>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <label class=""layui-form-label"">合并到栏目</label>" & vbCrlf
	Response.Write "        <div class=""layui-input-4"">" & vbCrlf
	Response.Write "            <div id=""sel_2_outer"" ztype=""select"" class=""z-combox"" style=""display:inline-block; *zoom: 1;*display: inline;vertical-align:middle;height:auto;width:auto;position:relative;border:none 0;margin:0;padding:0;white-space: nowrap;"" _style=""width:100%;height:30px;""><input type=""text"" ztype=""select"" id=""sel_2"" name=""sel_2"" tabindex=""-1"" autocomplete=""off"" class=""inputText"" style=""width:100%;height:30px;position:absolute;z-index:-1;"" value="""" startvalue="""" lay-verify=""sel_2""/><input type=""text"" id=""sel_2_textField"" autocomplete=""off"" class=""inputText"" style=""vertical-align:middle; cursor:default;width:100%;height:30px;"" /><a id=""sel_2_spinner"" class=""z-combox-spinner"" style=""position:relative; left:-17px; margin-right:-15px; cursor:pointer; width:13px; height:15px;vertical-align:middle;""><b></b></a><div id=""sel_2_list"" class=""optgroup"" style=""text-align:left;display:none;""><div id=""sel_2_ul"" style=""left:-1px; width:-1px;""><script>Combox_sel_2_Init=function(){var _el=Zving.getDom('sel_2');if(_el._components){return true;}var  _data=[];var  _DataSource;" & Class_Mod_List() & "var combox_sel_2 = new Zving.Selector({el:_el,data:_data,DataSource:_DataSource});};if(Zving.Page.isReady){Combox_sel_2_Init();}else{Zving.Page.onReady(Combox_sel_2_Init);}</script></div></div></div>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "    <div class=""layui-form-item"">" & vbCrlf
	Response.Write "        <div class=""layui-input-block"">" & vbCrlf
	Response.Write "            <button type=""button"" class=""layui-btn"" lay-submit="""" lay-filter=""submit"">开始合并</button>" & vbCrlf
	Response.Write "            <a href=""?ChannelID="&ChannelID&""" class=""layui-btn layui-btn-danger"">返回</a>" & vbCrlf
	Response.Write "        </div>" & vbCrlf
	Response.Write "    </div>" & vbCrlf
	Response.Write "</div>" & vbCrlf
	Response.Write "</form>" & vbCrlf
	Response.Write "<script>" & vbCrlf
	Response.Write "layui.use(['form'], function () {" & vbCrlf
	Response.Write "    var form = layui.form;" & vbCrlf
	Response.Write "    //自定义表单验证" & vbCrlf
	Response.Write "    form.verify({" & vbCrlf
	Response.Write "        sel_1: function (value, item) {" & vbCrlf
	Response.Write "            if (!value){" & vbCrlf
	Response.Write "                item.focus();" & vbCrlf
	Response.Write "                return ""从栏目不能为空！请填写！"";" & vbCrlf
 	Response.Write "            }" & vbCrlf
	Response.Write "        }," & vbCrlf
	Response.Write "        sel_2: function (value, item) {" & vbCrlf
	Response.Write "            if (!value){" & vbCrlf
	Response.Write "                item.focus();" & vbCrlf
	Response.Write "                return ""合并到栏目不能为空！请填写！"";" & vbCrlf
 	Response.Write "            }" & vbCrlf
	Response.Write "        }," & vbCrlf
	Response.Write "    });" & vbCrlf
	Response.Write "    //提交监听" & vbCrlf
	Response.Write "    form.on('submit(submit)', function (data) {" & vbCrlf
	Response.Write "        loading = layer.load(1, {shade: [0.1,'#fff']});" & vbCrlf
	Response.Write "        $.ajax({" & vbCrLf
	Response.Write "            type: 'post'," & vbCrLf
	Response.Write "            url: '?Action=SaveMod'," & vbCrLf
	Response.Write "            data: data.field," & vbCrLf
	Response.Write "            dataType: 'json'," & vbCrLf
	Response.Write "            success: function(res) {" & vbCrLf
	Response.Write "                layer.close(loading);" & vbCrlf
	Response.Write "                if(res.code > 0){" & vbCrlf
	If ChannelIsCreateHtml = True Then
		Response.Write "                    var diag = new Dialog({" & vbCrlf
		Response.Write "                        id:'CreateClass'," & vbCrlf
		Response.Write "                        title:'正在生成相关数据'," & vbCrlf
		Response.Write "                        url:'" & InstallDir & AdminFolder & "/" & ChannelDir & "/Admin_Create" & ChannelDir & ".asp?Action=ListCont&ClassList=1&ChannelID='+res.ChannelID+'&Csid='+res.ClassID+''," & vbCrlf
		Response.Write "                        width:450," & vbCrlf
		Response.Write "                        height:200," & vbCrlf
		Response.Write "                        modal:true" & vbCrlf
		Response.Write "                    });" & vbCrlf
		Response.Write "                    diag.autoClose=1;" & vbCrlf
		Response.Write "                    diag.show();" & vbCrlf
		Response.Write "                    setTimeout(function(){" & vbCrlf
		Response.Write "                        layer.msg(res.msg,{icon: 1, time: 1000},function(){" & vbCrlf
		Response.Write "                            location.href = res.url;" & vbCrlf
		Response.Write "                        });" & vbCrlf
		Response.Write "                    },1500);" & vbCrlf
	Else
		Response.Write "                    layer.msg(res.msg,{icon: 1, time: 1000},function(){" & vbCrlf
		Response.Write "                        location.href = res.url;" & vbCrlf
		Response.Write "                    });" & vbCrlf
	End If
	Response.Write "                }else{" & vbCrlf
	Response.Write "                    layer.msg(res.msg,{icon: 2, time: 1000});" & vbCrlf
	Response.Write "                }" & vbCrlf
	Response.Write "            }" & vbCrLf
	Response.Write "        });" & vbCrLf
	Response.Write "    });" & vbCrlf
	Response.Write "});" & vbCrlf
	Response.Write "</script>" & vbCrlf
	Response.Write "</body>" & vbCrLf & "</html>"
End Sub

Sub Class_SaveMod()
	If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
		Dim ftrue,fname1,fname2
		If ChannelDataName = "" Then
			Response.Write "{""code"":0,""msg"":""\u65e0\u6cd5\u786e\u5b9a\u6a21\u578b\u6240\u5728\u6570\u636e\u5e93\u4f4d\u7f6e\uff01""}" & vbCrLf
			Response.End()
			Exit Sub
		End If
		Dim sel1,sel2
		sel1=Code_Form("sel_1")
		sel2=Code_Form("sel_2")
		If Not(IsNumeric(sel1)) Or Not(IsNumeric(sel2)) Then
			Response.Write "{""code"":0,""msg"":""\u60a8\u6ca1\u6709\u9009\u62e9\u8981\u5408\u5e76\u7684\u680f\u76ee\uff01""}" & vbCrLf
			Response.End()
		Else
			sel1=Int(sel1)
			sel2=Int(sel2)
			ftrue=True
			Sql="Select ClassName From "&Data_Name&" Where ChannelID="&ChannelID&" And ClassID="&sel2
			Call Exec(Rs,Sql,2)
			If Rs.Eof Then
				ftrue=False
				Response.Write "{""code"":0,""msg"":""\u8f6c\u79fb\u680f\u76eeID\uff08"&sel1&"\uff09\u4e0d\u5b58\u5728\uff01""}" & vbCrLf
				Response.End()
			Else
				fname1=rs(0)
			End If
			Rs.Close
			If ftrue=True Then
				Sql="Select ClassName From "&Data_Name&" Where ChannelID="&ChannelID&" And ClassID="&sel1
				Call Exec(Rs,Sql,2)
				If Rs.Eof Then
					Response.Write "{""code"":0,""msg"":""\u4e3b\u680f\u76eeID\uff08"&sel1&"\uff09\u4e0d\u5b58\u5728\uff01""}" & vbCrLf
					Response.End()
				Else
					fname2=rs(0)
				End If
				Rs.Close
			End If
			If ftrue=True Then
				Call Exec("","Update "&ChannelDataName&" Set ClassID="&sel2&" Where ClassID="&sel1,0)
				Response.Write "{""code"":1,""msg"":""\u6210\u529f\u5c06\u680f\u76ee\uff08"&ToUnicode(fname2)&"\uff09\u6570\u636e\u5408\u5e76\u5230\u680f\u76ee\uff08"&ToUnicode(fname1)&"\uff09\u4e2d\uff01"",""ChannelID"":"&ChannelID&",""ClassID"":""" & sel1 & "," & sel2 & """,""url"":""?Action=Mod&ChannelID="&ChannelID&"""}" & vbCrLf
				Response.End()
				Exit Sub
			End If
		End If
	End If
End Sub

Function Class_Mod_List()
	Dim temp1,ncid,ClassChild
	ncid=0
	Sql="Select ClassID,AClassID,ClassName,ClassChild,ClassDepth From "&Data_Name&" Where ChannelID="&ChannelID&" Order By ClassOrder Asc,ClassID Asc"
	Call Exec(Rs,Sql,2)
	Do While Not Rs.Eof
		AClassID=Rs("AClassID")
		If Int(ncid)<>Int(AClassID) Then
			temp1=temp1&"_data.push(['"&Rs("ClassID")&"','╋"&Rs("ClassName")&"']);"
			ncid=AClassID
		Else
			temp1=temp1&"_data.push(['"&Rs("ClassID")&"','"
			For i=1 To Rs("ClassDepth")-1
				temp1=temp1&"│"
			Next
			temp1=temp1&"├"&Rs("ClassName")
			temp1=temp1&"']);"
		End If
		Rs.MoveNext
	Loop
	Rs.Close
	Class_Mod_List=temp1
End Function
%>